]> git.lizzy.rs Git - rust.git/commitdiff
Fix https://github.com/rust-analyzer/rust-analyzer/pull/2061#discussion_r348716036
authorSeivan Heidari <seivan.heidari@icloud.com>
Mon, 23 Dec 2019 23:04:36 +0000 (00:04 +0100)
committerSeivan Heidari <seivan.heidari@icloud.com>
Mon, 23 Dec 2019 23:04:36 +0000 (00:04 +0100)
Fix https://github.com/rust-analyzer/rust-analyzer/pull/2061/files/68a5ff050faf514e9d122212a66703ca8ce66ab7#r361019340

editors/code/package-lock.json
editors/code/src/highlighting.ts
editors/code/src/scopes.ts
editors/code/src/scopes_mapper.ts

index 4c5c13646c781793b27144b286cbdf525c8d2774..67081f3fdde827704068d0ea06c499b919380c18 100644 (file)
                 "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",
index 68eae094199a7a221fbbb63ef95049c6cd201cd7..4e224a54c11652056989fb2dbf97d5fb70e3d6c4 100644 (file)
@@ -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];
             }
index 8f288d7617b0a0b1ef481a221f80f9a94c9784f6..cb250b853ad0ecf50e721fdd441a4a73ea7a64e0 100644 (file)
@@ -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<string>());
@@ -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))
index 85c791ff50908364aaad77bace00aba616fe8545..e738fa2396d6c9f7fe22a3dbaca3147fcc1d9e0d 100644 (file)
@@ -10,15 +10,15 @@ const defaultMapping = new Map<string, string[]>([
             '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<string, string[]>([
     ['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<string, string[]>([
             '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)