aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/commands
diff options
context:
space:
mode:
Diffstat (limited to 'editors/code/src/commands')
-rw-r--r--editors/code/src/commands/syntax_tree.ts11
1 files changed, 8 insertions, 3 deletions
diff --git a/editors/code/src/commands/syntax_tree.ts b/editors/code/src/commands/syntax_tree.ts
index 996c7a716..8d71cb39e 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 {
15 void new AstInspector(ctx); 15 void new AstInspector(ctx);
16 16
17 ctx.pushCleanup(vscode.workspace.registerTextDocumentContentProvider(AST_FILE_SCHEME, tdcp)); 17 ctx.pushCleanup(vscode.workspace.registerTextDocumentContentProvider(AST_FILE_SCHEME, tdcp));
18 ctx.pushCleanup(vscode.languages.setLanguageConfiguration("ra_syntax_tree", {
19 brackets: [["[", ")"]],
20 }));
18 21
19 return async () => { 22 return async () => {
20 const editor = vscode.window.activeTextEditor; 23 const editor = vscode.window.activeTextEditor;
@@ -36,7 +39,7 @@ export function syntaxTree(ctx: Ctx): Cmd {
36} 39}
37 40
38class TextDocumentContentProvider implements vscode.TextDocumentContentProvider { 41class TextDocumentContentProvider implements vscode.TextDocumentContentProvider {
39 readonly uri = vscode.Uri.parse('rust-analyzer://syntaxtree'); 42 readonly uri = vscode.Uri.parse('rust-analyzer://syntaxtree/tree.rast');
40 readonly eventEmitter = new vscode.EventEmitter<vscode.Uri>(); 43 readonly eventEmitter = new vscode.EventEmitter<vscode.Uri>();
41 44
42 45
@@ -81,8 +84,10 @@ class TextDocumentContentProvider implements vscode.TextDocumentContentProvider
81// https://code.visualstudio.com/api/extension-guides/tree-view 84// https://code.visualstudio.com/api/extension-guides/tree-view
82class AstInspector implements vscode.HoverProvider, Disposable { 85class AstInspector implements vscode.HoverProvider, Disposable {
83 private static readonly astDecorationType = vscode.window.createTextEditorDecorationType({ 86 private static readonly astDecorationType = vscode.window.createTextEditorDecorationType({
84 fontStyle: "normal", 87 borderColor: new vscode.ThemeColor('rust_analyzer.syntaxTreeBorder'),
85 border: "#ffffff 1px solid", 88 borderStyle: "solid",
89 borderWidth: "2px",
90
86 }); 91 });
87 private rustEditor: undefined | RustEditor; 92 private rustEditor: undefined | RustEditor;
88 93