eclipse-platform / eclipse-platform/eclipse.platform

Improve interoperability of IConsoleLineTrackers with consoles with ANSI-escaped print-out

Aperta
#539 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Java
Stelle
165
Fork
174
Merge medio
2g 8h
PR unite (30g)
22

Descrizione

In M2E we use an implementation of the `IConsoleLineTracker`, which registered via the `org.eclipse.debug.ui.consoleLineTrackers` extension point, to track the console output for Maven specific printout to attach links to the console's text and to perform some actions on certain print-out (i.e. launch a debugger).

The new (great) support of ANSI escape sequences for colored console print-out brings the problem that such line-trackers are usually not aware of those escape sequences and actually operate on the text without escape sequences. For example to make the [MavenConsoleLineTracker](https://github.com/eclipse-m2e/m2e-core/blob/master/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenConsoleLineTracker.java) work with colored console print-out the text obtained for the `IRegion` of the console's `IDocument` has to be filtered for those escape sequences: https://github.com/eclipse-m2e/m2e-core/pull/535
It would be better if the console itself would provide means to do that so that other parts of the code can be made 'colored-print-out' ready more easily.

This could either be achieved by providing means to obtain the unescaped text of a given 'raw' region and to add a link with an unescaped region. But this would probably also involve the `eclipse.platform.text` code. Furthermore not only obtaining the text, but also the addition of links would require special handling.

An alternative could be to just pass the unescaped text to the console document, to create all regions passed to the trackers based on the unescaped text and also create the links based on offset respectively the unescaped text. Given that the console has to detect the escape sequences any way this could also be more performant (but I'm not familiar with the details). Furthermore it would not require any adjustments of existing `IConsoleLineTracker` implementations because they could continue to work as they are.
If one really wants the raw text the console could provide methods like `getRawDocument()`, `addRawLink()` or `getRawRegion(IRegion)` that operate on the raw uninterpreted text that contains the escape sequences (but I don't know why anything besides the color-interpreter would want that).
If this is done on a basic level maybe even existing `IPatternMatchListener` can benefit from.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia dal punto di estensione IConsoleLineTracker e dall’esempio MavenConsoleLineTracker collegato nell’issue, quindi esamina le API della console e il codice correlato di eclipse.platform.text. Confronta gli approcci unescaped-region e unescaped-document, comprese le implicazioni per la gestione di add-link e IPatternMatchListener. Il lavoro è completato quando esistono un design concordato e un supporto della console che consentano ai tracker esistenti di gestire output colorato ANSI.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
java
Ambito
tooling
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.