aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/commands/syntax_tree.ts
diff options
context:
space:
mode:
Diffstat (limited to 'editors/code/src/commands/syntax_tree.ts')
-rw-r--r--editors/code/src/commands/syntax_tree.ts9
1 files changed, 4 insertions, 5 deletions
diff --git a/editors/code/src/commands/syntax_tree.ts b/editors/code/src/commands/syntax_tree.ts
index 5b8f6e4d9..2ee80f910 100644
--- a/editors/code/src/commands/syntax_tree.ts
+++ b/editors/code/src/commands/syntax_tree.ts
@@ -76,7 +76,8 @@ class TextDocumentContentProvider
76 76
77 provideTextDocumentContent(uri: vscode.Uri): vscode.ProviderResult<string> { 77 provideTextDocumentContent(uri: vscode.Uri): vscode.ProviderResult<string> {
78 const editor = vscode.window.activeTextEditor; 78 const editor = vscode.window.activeTextEditor;
79 if (editor == null) return ''; 79 const client = this.ctx.client
80 if (!editor || !client) return '';
80 81
81 let range: lc.Range | undefined; 82 let range: lc.Range | undefined;
82 83
@@ -84,16 +85,14 @@ class TextDocumentContentProvider
84 if (uri.query === 'range=true') { 85 if (uri.query === 'range=true') {
85 range = editor.selection.isEmpty 86 range = editor.selection.isEmpty
86 ? undefined 87 ? undefined
87 : this.ctx.client.code2ProtocolConverter.asRange( 88 : client.code2ProtocolConverter.asRange(editor.selection);
88 editor.selection,
89 );
90 } 89 }
91 90
92 const request: SyntaxTreeParams = { 91 const request: SyntaxTreeParams = {
93 textDocument: { uri: editor.document.uri.toString() }, 92 textDocument: { uri: editor.document.uri.toString() },
94 range, 93 range,
95 }; 94 };
96 return this.ctx.client.sendRequest<string>( 95 return client.sendRequest<string>(
97 'rust-analyzer/syntaxTree', 96 'rust-analyzer/syntaxTree',
98 request, 97 request,
99 ); 98 );