aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/scopes_mapper.ts
diff options
context:
space:
mode:
authorSeivan Heidari <[email protected]>2019-10-31 09:36:54 +0000
committerSeivan Heidari <[email protected]>2019-10-31 09:36:54 +0000
commit1f822c8e518132b01d7eda665f6bf7bc254780a7 (patch)
treefd36b1b6d88548ae630562febca9ad1426dbf42e /editors/code/src/scopes_mapper.ts
parent8edda0e7b164009d6c03bb3d4be603fb38ad2e2a (diff)
Adding better debugging for testing themes missing tags and which scopes didn't map.
Since this file is no longer being pushed upstream, double down on monads.
Diffstat (limited to 'editors/code/src/scopes_mapper.ts')
-rw-r--r--editors/code/src/scopes_mapper.ts11
1 files changed, 7 insertions, 4 deletions
diff --git a/editors/code/src/scopes_mapper.ts b/editors/code/src/scopes_mapper.ts
index 4534d8a32..19a4213d4 100644
--- a/editors/code/src/scopes_mapper.ts
+++ b/editors/code/src/scopes_mapper.ts
@@ -28,21 +28,24 @@ const defaultMapping = new Map<string, string[]>([
28 ['module', ['entity.name.section', 'entity.other']] 28 ['module', ['entity.name.section', 'entity.other']]
29] 29]
30) 30)
31function find(scope: string): string[] { 31
32// Temporary exported for debugging for now.
33export function find(scope: string): string[] {
32 return mappings.get(scope) || [] 34 return mappings.get(scope) || []
33} 35}
34 36
35export function toRule(scope: string, intoRule: (scope: string) => TextMateRuleSettings | undefined): TextMateRuleSettings | undefined { 37export function toRule(scope: string, intoRule: (scope: string) => TextMateRuleSettings | undefined): TextMateRuleSettings | undefined {
36 return find(scope).map(intoRule).filter(rule => rule !== undefined)[0]; 38 return find(scope).map(intoRule).filter(rule => rule !== undefined)[0]
37} 39}
38 40
39 41
40export function load() { 42export function load() {
41 const configuration = vscode.workspace 43 const configuration = vscode.workspace
42 .getConfiguration('rust-analyzer') 44 .getConfiguration('rust-analyzer')
43 .get('scopeMappings') as Map<string, string[]> | undefined || new Map() 45 .get('scopeMappings') as Map<string, string[]> | undefined
46 || new Map()
44 47
45 mappings = new Map([...Array.from(defaultMapping.entries()), ...Array.from(configuration.entries())]); 48 mappings = new Map([...Array.from(defaultMapping.entries()), ...Array.from(configuration.entries())])
46 49
47 50
48} \ No newline at end of file 51} \ No newline at end of file