From 25537d294cb7a3e01d2329a7d07b469d734fc829 Mon Sep 17 00:00:00 2001 From: Seivan Heidari Date: Tue, 24 Dec 2019 00:04:36 +0100 Subject: Fix https://github.com/rust-analyzer/rust-analyzer/pull/2061#discussion_r348716036 Fix https://github.com/rust-analyzer/rust-analyzer/pull/2061/files/68a5ff050faf514e9d122212a66703ca8ce66ab7#r361019340 --- editors/code/package-lock.json | 5 +++++ editors/code/src/highlighting.ts | 4 ++-- editors/code/src/scopes.ts | 10 +++++----- editors/code/src/scopes_mapper.ts | 17 ++++++++--------- 4 files changed, 20 insertions(+), 16 deletions(-) (limited to 'editors') diff --git a/editors/code/package-lock.json b/editors/code/package-lock.json index 4c5c13646..67081f3fd 100644 --- a/editors/code/package-lock.json +++ b/editors/code/package-lock.json @@ -750,6 +750,11 @@ "esprima": "^4.0.0" } }, + "jsonc-parser": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-2.2.0.tgz", + "integrity": "sha512-4fLQxW1j/5fWj6p78vAlAafoCKtuBm6ghv+Ij5W2DrDx0qE+ZdEl2c6Ko1mgJNF5ftX1iEWQQ4Ap7+3GlhjkOA==" + }, "lines-and-columns": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz", diff --git a/editors/code/src/highlighting.ts b/editors/code/src/highlighting.ts index 68eae0941..4e224a54c 100644 --- a/editors/code/src/highlighting.ts +++ b/editors/code/src/highlighting.ts @@ -26,7 +26,7 @@ function fancify(seed: string, shade: 'light' | 'dark') { } function createDecorationFromTextmate( - themeStyle: scopes.TextMateRuleSettings + themeStyle: scopes.TextMateRuleSettings, ): vscode.TextEditorDecorationType { const decorationOptions: vscode.DecorationRenderOptions = {}; decorationOptions.rangeBehavior = vscode.DecorationRangeBehavior.OpenOpen; @@ -84,7 +84,7 @@ export class Highlighter { const color = new vscode.ThemeColor(fallBackTag); const decor = vscode.window.createTextEditorDecorationType({ color, - textDecoration + textDecoration, }); return [tag, decor]; } diff --git a/editors/code/src/scopes.ts b/editors/code/src/scopes.ts index 8f288d761..cb250b853 100644 --- a/editors/code/src/scopes.ts +++ b/editors/code/src/scopes.ts @@ -58,10 +58,10 @@ function loadThemeNamed(themeName: string) { return extension.packageJSON.contributes.themes .filter( (element: any) => - (element.id || element.label) === themeName + (element.id || element.label) === themeName, ) .map((element: any) => - path.join(extension.extensionPath, element.path) + path.join(extension.extensionPath, element.path), ) .concat(list); }, Array()); @@ -71,7 +71,7 @@ function loadThemeNamed(themeName: string) { const tokenColorCustomizations: [any] = [ vscode.workspace .getConfiguration('editor') - .get('tokenColorCustomizations') + .get('tokenColorCustomizations'), ]; tokenColorCustomizations @@ -100,7 +100,7 @@ function loadThemeFile(themePath: string) { function mergeRuleSettings( defaultSetting: TextMateRuleSettings | undefined, - override: TextMateRuleSettings + override: TextMateRuleSettings, ): TextMateRuleSettings { if (defaultSetting === undefined) { return override; @@ -116,7 +116,7 @@ function mergeRuleSettings( function updateRules( scope: string, - updatedSettings: TextMateRuleSettings + updatedSettings: TextMateRuleSettings, ): void { [rules.get(scope)] .map(settings => mergeRuleSettings(settings, updatedSettings)) diff --git a/editors/code/src/scopes_mapper.ts b/editors/code/src/scopes_mapper.ts index 85c791ff5..e738fa239 100644 --- a/editors/code/src/scopes_mapper.ts +++ b/editors/code/src/scopes_mapper.ts @@ -10,15 +10,15 @@ const defaultMapping = new Map([ 'comment', 'comment.block', 'comment.line', - 'comment.block.documentation' - ] + 'comment.block.documentation', + ], ], ['string', ['string']], ['keyword', ['keyword']], ['keyword.control', ['keyword.control', 'keyword', 'keyword.other']], [ 'keyword.unsafe', - ['storage.modifier', 'keyword.other', 'keyword.control', 'keyword'] + ['storage.modifier', 'keyword.other', 'keyword.control', 'keyword'], ], ['function', ['entity.name.function']], ['parameter', ['variable.parameter']], @@ -28,7 +28,7 @@ const defaultMapping = new Map([ ['text', ['string', 'string.quoted', 'string.regexp']], ['attribute', ['keyword']], ['literal', ['string', 'string.quoted', 'string.regexp']], - ['macro', ['support.other']], + ['macro', ['entity.name.function', 'keyword.other', 'entity.name.macro']], ['variable', ['variable']], ['variable.mut', ['variable', 'storage.modifier']], [ @@ -37,20 +37,19 @@ const defaultMapping = new Map([ 'variable.object.property', 'meta.field.declaration', 'meta.definition.property', - 'variable.other' - ] + 'variable.other', + ], ], - ['module', ['entity.name.section', 'entity.other']] + ['module', ['entity.name.section', 'entity.other']], ]); -// Temporary exported for debugging for now. export function find(scope: string): string[] { return mappings.get(scope) || []; } export function toRule( scope: string, - intoRule: (scope: string) => TextMateRuleSettings | undefined + intoRule: (scope: string) => TextMateRuleSettings | undefined, ): TextMateRuleSettings | undefined { return find(scope) .map(intoRule) -- cgit v1.2.3