Introducing a Scopes Mapper to map from RA scopes to TextMate scopes with fallbacks.

Current scopes defined:
```
    ['keyword.unsafe', ['storage.modifier', 'keyword.other', 'keyword.control']],
    ['function', ['entity.name.function']],
    ['parameter', ['variable.parameter']],
    ['type', ['entity.name.type']],
    ['builtin', ['variable.language', 'support.type', 'support.type']],
    ['text', ['string', 'string.quoted', 'string.regexp']],
    ['attribute', ['keyword']],
    ['literal', ['string', 'string.quoted', 'string.regexp']],
    ['macro', ['support.other']],
    ['variable.mut', ['variable']],
    ['field', ['variable.object.property']],
    ['module', ['entity.name.section']]
```

Need to complement with further fallbacks as some themes fail.
This commit is contained in:
Seivan Heidari 2019-10-27 17:57:11 +01:00
parent 5957b851e4
commit 0ddf47a7ab
4 changed files with 60 additions and 13 deletions

View file

@ -1,5 +1,6 @@
import * as vscode from 'vscode';
import * as scopes from './scopes';
import * as scopesMapper from './scopes_mapper';
import { Server } from './server';
const RA_LSP_DEBUG = process.env.__RA_LSP_SERVER_DEBUG;
@ -49,6 +50,7 @@ export class Config {
Server.highlighter.removeHighlights();
scopes.load()
scopesMapper.load()
if (config.has('highlightingOn')) {
this.highlightingOn = config.get('highlightingOn') as boolean;