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.ts16
1 files changed, 10 insertions, 6 deletions
diff --git a/editors/code/src/extension.ts b/editors/code/src/extension.ts
index 8b332eeb2..941beba18 100644
--- a/editors/code/src/extension.ts
+++ b/editors/code/src/extension.ts
@@ -2,7 +2,7 @@ import * as vscode from 'vscode';
2import * as lc from 'vscode-languageclient'; 2import * as lc from 'vscode-languageclient';
3 3
4import * as commands from './commands'; 4import * as commands from './commands';
5import { TextDocumentContentProvider } from './commands/syntaxTree'; 5import { SyntaxTreeContentProvider } from './commands/syntaxTree';
6import * as events from './events'; 6import * as events from './events';
7import * as notifications from './notifications'; 7import * as notifications from './notifications';
8import { Server } from './server'; 8import { Server } from './server';
@@ -52,7 +52,6 @@ export function activate(context: vscode.ExtensionContext) {
52 registerCommand('rust-analyzer.collectGarbage', () => 52 registerCommand('rust-analyzer.collectGarbage', () =>
53 Server.client.sendRequest<null>('rust-analyzer/collectGarbage', null) 53 Server.client.sendRequest<null>('rust-analyzer/collectGarbage', null)
54 ); 54 );
55 registerCommand('rust-analyzer.syntaxTree', commands.syntaxTree.handle);
56 registerCommand( 55 registerCommand(
57 'rust-analyzer.extendSelection', 56 'rust-analyzer.extendSelection',
58 commands.extendSelection.handle 57 commands.extendSelection.handle
@@ -95,22 +94,27 @@ export function activate(context: vscode.ExtensionContext) {
95 notifications.publishDecorations.handle 94 notifications.publishDecorations.handle
96 ] 95 ]
97 ]; 96 ];
97 const syntaxTreeContentProvider = new SyntaxTreeContentProvider();
98 98
99 // The events below are plain old javascript events, triggered and handled by vscode 99 // The events below are plain old javascript events, triggered and handled by vscode
100 vscode.window.onDidChangeActiveTextEditor( 100 vscode.window.onDidChangeActiveTextEditor(
101 events.changeActiveTextEditor.handle 101 events.changeActiveTextEditor.makeHandler(syntaxTreeContentProvider)
102 ); 102 );
103 103
104 const textDocumentContentProvider = new TextDocumentContentProvider();
105 disposeOnDeactivation( 104 disposeOnDeactivation(
106 vscode.workspace.registerTextDocumentContentProvider( 105 vscode.workspace.registerTextDocumentContentProvider(
107 'rust-analyzer', 106 'rust-analyzer',
108 textDocumentContentProvider 107 syntaxTreeContentProvider
109 ) 108 )
110 ); 109 );
111 110
111 registerCommand(
112 'rust-analyzer.syntaxTree',
113 commands.syntaxTree.createHandle(syntaxTreeContentProvider)
114 );
115
112 vscode.workspace.onDidChangeTextDocument( 116 vscode.workspace.onDidChangeTextDocument(
113 events.changeTextDocument.createHandler(textDocumentContentProvider), 117 events.changeTextDocument.createHandler(syntaxTreeContentProvider),
114 null, 118 null,
115 context.subscriptions 119 context.subscriptions
116 ); 120 );