aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/scopes_mapper.ts
diff options
context:
space:
mode:
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