* Adding scope mapping configuration manifest in package.json

* Loading configurable scope mappings from settings.
* Updating Readme with `rust-analyzer.scopeMappings`.
`rust-analyzer.scopeMappings` -- a scheme backed JSON object to tweak Rust Analyzer scopes to TextMate scopes.
   ```jsonc
    {
        //Will autocomplete keys to available RA scopes.
        "keyword.unsafe": ["keyword", "keyword.control"],
        //Values are string | TextMateScope | [string | TextMateScope]
        "comments": "comment.block"
    }
   ```
This commit is contained in:
Seivan Heidari 2019-11-04 23:59:11 +01:00
parent dad9bc6caa
commit c60f9bf4c6
6 changed files with 151 additions and 68 deletions

View file

@ -48,11 +48,13 @@ export class Config {
const config = vscode.workspace.getConfiguration('rust-analyzer');
Server.highlighter.removeHighlights();
scopes.load()
scopesMapper.load()
if (config.has('highlightingOn')) {
if (config.has('highlightingOn')) {
this.highlightingOn = config.get('highlightingOn') as boolean;
if (this.highlightingOn) {
scopes.load();
scopesMapper.load();
}
}
if (config.has('rainbowHighlightingOn')) {
@ -61,9 +63,6 @@ export class Config {
) as boolean;
}
if (!this.highlightingOn && Server) {
Server.highlighter.removeHighlights();
}
if (config.has('enableEnhancedTyping')) {
this.enableEnhancedTyping = config.get(