diff options
| author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-04-02 07:32:14 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-02 07:32:14 +0000 |
| commit | f0ba01cd43489f0029e90fa7857c88b4e31f9996 (patch) | |
| tree | 67cfd74fa8cadca05c5ddfe436aa2640f80fef86 /editors/code/src | |
| parent | 93f21ac624815dc58ea367eb4127526564206e84 (diff) | |
| parent | 62ed01a1078f499c93c70025342dd869bd277d39 (diff) | |
| download | rust-f0ba01cd43489f0029e90fa7857c88b4e31f9996.tar.gz rust-f0ba01cd43489f0029e90fa7857c88b4e31f9996.zip | |
Merge #3817
3817: vscode: highlight syntax tree ro editor r=matklad a=Veetaha
Small textmate grammar declaration to make rust-analyzer syntax tree more easily inspectable:
Btw, if we change the file extension of our `ra_syntax/test_data/**` files to `.rast` they should be highlighted in vscode too.
The colors of the tokens are actually going to be color-theme dependent, or you can customize them via:
```jsonc
{
"editor.tokenColorCustomizations": {
"textMateRules": [ { "scope": "name", "settings": { /* */ } } ]
}
}
```

Related: #3682
Co-authored-by: veetaha <veetaha2@gmail.com>
Diffstat (limited to 'editors/code/src')
| -rw-r--r-- | editors/code/src/commands/syntax_tree.ts | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/editors/code/src/commands/syntax_tree.ts b/editors/code/src/commands/syntax_tree.ts index ad98786171e..8d71cb39e31 100644 --- a/editors/code/src/commands/syntax_tree.ts +++ b/editors/code/src/commands/syntax_tree.ts @@ -15,6 +15,9 @@ export function syntaxTree(ctx: Ctx): Cmd { void new AstInspector(ctx); ctx.pushCleanup(vscode.workspace.registerTextDocumentContentProvider(AST_FILE_SCHEME, tdcp)); + ctx.pushCleanup(vscode.languages.setLanguageConfiguration("ra_syntax_tree", { + brackets: [["[", ")"]], + })); return async () => { const editor = vscode.window.activeTextEditor; @@ -36,7 +39,7 @@ export function syntaxTree(ctx: Ctx): Cmd { } class TextDocumentContentProvider implements vscode.TextDocumentContentProvider { - readonly uri = vscode.Uri.parse('rust-analyzer://syntaxtree'); + readonly uri = vscode.Uri.parse('rust-analyzer://syntaxtree/tree.rast'); readonly eventEmitter = new vscode.EventEmitter<vscode.Uri>(); |
