aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/extension.ts
diff options
context:
space:
mode:
Diffstat (limited to 'editors/code/src/extension.ts')
-rw-r--r--editors/code/src/extension.ts12
1 files changed, 12 insertions, 0 deletions
diff --git a/editors/code/src/extension.ts b/editors/code/src/extension.ts
index c06928d12..683497dfd 100644
--- a/editors/code/src/extension.ts
+++ b/editors/code/src/extension.ts
@@ -3,6 +3,7 @@ import * as lc from 'vscode-languageclient';
3 3
4import * as commands from './commands'; 4import * as commands from './commands';
5import { CargoWatchProvider } from './commands/cargo_watch'; 5import { CargoWatchProvider } from './commands/cargo_watch';
6import { ExpandMacroContentProvider } from './commands/expand_macro';
6import { HintsUpdater } from './commands/inlay_hints'; 7import { HintsUpdater } from './commands/inlay_hints';
7import { 8import {
8 interactivelyStartCargoWatch, 9 interactivelyStartCargoWatch,
@@ -97,6 +98,7 @@ export function activate(context: vscode.ExtensionContext) {
97 ] 98 ]
98 ]; 99 ];
99 const syntaxTreeContentProvider = new SyntaxTreeContentProvider(); 100 const syntaxTreeContentProvider = new SyntaxTreeContentProvider();
101 const expandMacroContentProvider = new ExpandMacroContentProvider();
100 102
101 // The events below are plain old javascript events, triggered and handled by vscode 103 // The events below are plain old javascript events, triggered and handled by vscode
102 vscode.window.onDidChangeActiveTextEditor( 104 vscode.window.onDidChangeActiveTextEditor(
@@ -109,11 +111,21 @@ export function activate(context: vscode.ExtensionContext) {
109 syntaxTreeContentProvider 111 syntaxTreeContentProvider
110 ) 112 )
111 ); 113 );
114 disposeOnDeactivation(
115 vscode.workspace.registerTextDocumentContentProvider(
116 'rust-analyzer',
117 expandMacroContentProvider
118 )
119 );
112 120
113 registerCommand( 121 registerCommand(
114 'rust-analyzer.syntaxTree', 122 'rust-analyzer.syntaxTree',
115 commands.syntaxTree.createHandle(syntaxTreeContentProvider) 123 commands.syntaxTree.createHandle(syntaxTreeContentProvider)
116 ); 124 );
125 registerCommand(
126 'rust-analyzer.expandMacro',
127 commands.expandMacro.createHandle(expandMacroContentProvider)
128 );
117 129
118 vscode.workspace.onDidChangeTextDocument( 130 vscode.workspace.onDidChangeTextDocument(
119 events.changeTextDocument.createHandler(syntaxTreeContentProvider), 131 events.changeTextDocument.createHandler(syntaxTreeContentProvider),