-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for issue #2906 (semantic highlighting styles overruled by TM sco…
…pes) The idea for the fix comes from the observation that there are VSCode plugins that implement semantic highlighting using TextEditor.setDecorations(), and do not suffer from this problem. We don't want to use setDecorations() itself because it's not really suited for incremental updates to the highlighting (which the LSP protocol extension that Theia implements allows for). However, setDecorations() is implemented in terms of deltaDecorations() (which is what Theia uses), and changing Theia's use of deltaDecorations() to be more like the implementation of setDecorations() seems to fix this bug. Specifically, instead of getting an inlineClassName directly from the TokenMetadata (which seems to produce the problematic inlineClassName that coflicts with TM), we: * Get the token color from the TokenMetadata * Construct an IDecorationRenderOptions from the token color (as if we were going to call setDecorations()) * Use ICodeEditorService.registerDecorationType() and ICodeEditorService.resolveDecorationOptions() to massage the IDecorationRenderOptions into an IModelDecorationOptions. This appears to cause monaco to allocate a new inlineClassName for the color which doesn't conflict with TM. * Call deltaDecorations() with IModelDecorationOptions obtained in this way
- Loading branch information
1 parent
d059f9e
commit 20e7171
Showing
1 changed file
with
111 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters