Add SourceViewer#computeStyleRanges() to highlight external documents#3868
Conversation
6571f85 to
18539e5
Compare
|
test error org.eclipse.e4.ui.tests.workbench.PartRenderingEngineTests#ensureCleanUpAddonCleansUp not related to this change (#3581) |
18539e5 to
0afb18c
Compare
This test is fixed now (since yesterday) |
vogella
left a comment
There was a problem hiding this comment.
Idea is sound and SourceViewer is a reasonable place for this. Main concern is exception-safety of the partitioner swap (see inline on the final connect(originalDocument)); the rest are tightenings.
Introduces computeStyleRanges(IDocument, IRegion) on SourceViewer, which applies the viewer's own presentation reconciler and partitioner to an external document, returning the resulting SWT StyleRanges for the given region without affecting the viewer's current document.
0afb18c to
c47d26a
Compare
|
I'm not a committer but I guess it might be useful to add some tests ensuring there won't be any regressions here? |
For API especially. |
@danthe1st @trancexpress test added with d6456a7 |
|
Thanks for the iteration @tobiasmelcher. Two remaining concerns before I'm comfortable approving. The unit-test angle can be handled in a follow-up.
|
SourceViewer#computeStyleRanges()
@vogella thanks a lot for the review - should be now done with 392609f |
partitioner restore
|
Thanks @tobiasmelcher LGTM, please merge. |
Introduces computeStyleRanges(IDocument, IRegion) on SourceViewer, which applies the viewer's own presentation reconciler and partitioner to an external document, returning the resulting SWT StyleRanges for the given region without affecting the viewer's current document.
This method will be used by the unified diff implementation to calculate the syntax coloring for the parts rendered inside the code mining which are not part of the original editor document (see eclipse-platform/eclipse.platform#2560).