From 8c2cd28c48ffc1a82528469cde7bf1242e5110f7 Mon Sep 17 00:00:00 2001 From: Seivan Heidari Date: Sun, 27 Oct 2019 23:49:41 +0100 Subject: Adding debugging to figure out missing scopes from theme. --- editors/code/src/highlighting.ts | 9 ++++----- editors/code/src/scopes_mapper.ts | 12 ++++++------ 2 files changed, 10 insertions(+), 11 deletions(-) (limited to 'editors') diff --git a/editors/code/src/highlighting.ts b/editors/code/src/highlighting.ts index bc19fae2f..b7dffaff5 100644 --- a/editors/code/src/highlighting.ts +++ b/editors/code/src/highlighting.ts @@ -66,15 +66,14 @@ export class Highlighter { textDecoration?: string ): [string, vscode.TextEditorDecorationType] => { - const foundRule = scopesMapper.toRule(tag, scopes.find) || scopes.find(tag) + const rule = scopesMapper.toRule(tag, scopes.find) - - - if (foundRule) { - const decor = createDecorationFromTextmate(foundRule); + if (rule) { + const decor = createDecorationFromTextmate(rule); return [tag, decor]; } else { + console.log('Missing theme for: ' + tag); const color = new vscode.ThemeColor('ralsp.' + tag); const decor = vscode.window.createTextEditorDecorationType({ color, diff --git a/editors/code/src/scopes_mapper.ts b/editors/code/src/scopes_mapper.ts index 5c3cb8f63..4534d8a32 100644 --- a/editors/code/src/scopes_mapper.ts +++ b/editors/code/src/scopes_mapper.ts @@ -8,11 +8,11 @@ let mappings = new Map() const defaultMapping = new Map([ - ['comment', ['comment']], + ['comment', ['comment', 'comment.block', 'comment.line', 'comment.block.documentation']], ['string', ['string']], ['keyword', ['keyword']], ['keyword.control', ['keyword.control', 'keyword', 'keyword.other']], - ['keyword.unsafe', ['storage.modifier', 'keyword.other', 'keyword.control']], + ['keyword.unsafe', ['storage.modifier', 'keyword.other', 'keyword.control', 'keyword']], ['function', ['entity.name.function']], ['parameter', ['variable.parameter']], ['constant', ['constant', 'variable']], @@ -23,9 +23,9 @@ const defaultMapping = new Map([ ['literal', ['string', 'string.quoted', 'string.regexp']], ['macro', ['support.other']], ['variable', ['variable']], - ['variable.mut', ['variable']], - ['field', ['variable.object.property']], - ['module', ['entity.name.section']] + ['variable.mut', ['variable', 'storage.modifier']], + ['field', ['variable.object.property', 'meta.field.declaration', 'meta.definition.property', 'variable.other',]], + ['module', ['entity.name.section', 'entity.other']] ] ) function find(scope: string): string[] { @@ -33,7 +33,7 @@ function find(scope: string): string[] { } export function toRule(scope: string, intoRule: (scope: string) => TextMateRuleSettings | undefined): TextMateRuleSettings | undefined { - return find(scope).map(intoRule).find(rule => rule !== null) + return find(scope).map(intoRule).filter(rule => rule !== undefined)[0]; } -- cgit v1.2.3