Add vscode support for range in SyntaxTreeParams

This enables the client to use a command to either show the live-updating
version of the syntax tree for the current file. Or optionally when a selected
range is provided, we then provide a snapshot of the syntax tree for the range.
This commit is contained in:
Ville Penttinen 2019-03-03 21:21:40 +02:00
parent ac52d9a1f1
commit c2d3203d0c
3 changed files with 41 additions and 11 deletions

View file

@ -52,7 +52,6 @@ export function activate(context: vscode.ExtensionContext) {
registerCommand('rust-analyzer.collectGarbage', () =>
Server.client.sendRequest<null>('rust-analyzer/collectGarbage', null)
);
registerCommand('rust-analyzer.syntaxTree', commands.syntaxTree.handle);
registerCommand(
'rust-analyzer.extendSelection',
commands.extendSelection.handle
@ -109,6 +108,11 @@ export function activate(context: vscode.ExtensionContext) {
)
);
registerCommand(
'rust-analyzer.syntaxTree',
commands.syntaxTree.createHandle(textDocumentContentProvider)
);
vscode.workspace.onDidChangeTextDocument(
events.changeTextDocument.createHandler(textDocumentContentProvider),
null,