Open kittaakos opened 6 years ago
If I switched back before the [textmate] Use vscode-textmate, for instance to b6e09bdf, it works.
Also, it seems, there is some sort of precedence between the auto-generated inline class names. For instance, if the inlineClassName
of the TM style is mtk6
and the style from the LS is mtk8
, then the style from the LS wins. If the other way around, then the TM class overrides the style from the LS.
POC @ Monaco Editor Playground with the following code:
var jsCode = [
'"use strict";',
'function Person(age) {',
' if (age) {',
' this.age = age;',
' }',
'}',
'Person.prototype.getAge = function () {',
' return this.age;',
'};'
].join('\n');
var editor = monaco.editor.create(document.getElementById("container"), {
value: jsCode,
language: "javascript"
});
var decorations = editor.deltaDecorations([], [
{ range: new monaco.Range(2,2,2,5), options: { inlineClassName: 'mtk22' }},
{ range: new monaco.Range(7,2,7,5), options: { inlineClassName: 'mtk6' }},
]);
The unc
part is overriding the rule for function
.
It does not work for ers
in Person
although the spans are correct in the DOM.
<span><span class="mtk22">P</span><span class="mtk22 mtk6">ers</span><span class="mtk22">on</span><span class="mtk1">.prototype.getAge = </span><span class="mtk6">function</span><span class="mtk1"> () {</span></span>
To clarify things here:
mtk${NUMBER}
.${NUMBER}
will win.Proposed solution:
mtk${NUMBER}
class, and the number is smaller than the number for the semantic highlighting decoration.Proposed solution:
- When we're applying the semantic highlighting styles (from the LS), we have to delete all decorations that have
mtk${NUMBER}
class, and the number is smaller than the number for the semantic highlighting decoration.
This is not possible, as the editor does not know about the syntax colored tokens as decorations. Instead of that, we need to customize the renderer, when we merge the TM tokens with the inline decorations: https://github.com/Microsoft/vscode/blob/c7b13ccb535e3035eb7a9afc1d1c74e0fb11c9ed/src/vs/editor/common/viewLayout/viewLineRenderer.ts#L602-L652
I am not sure if it is related to a recent TM change or the
monaco
update but it is broken in Theia. LSs cannot provide custom colors anymore.See: https://github.com/theia-ide/yangster/pull/65#issuecomment-422367974