diff options
Diffstat (limited to 'editors/code/src/commands/expand_macro.ts')
-rw-r--r-- | editors/code/src/commands/expand_macro.ts | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/editors/code/src/commands/expand_macro.ts b/editors/code/src/commands/expand_macro.ts index da208257a..472f43b8d 100644 --- a/editors/code/src/commands/expand_macro.ts +++ b/editors/code/src/commands/expand_macro.ts | |||
@@ -52,14 +52,15 @@ class TextDocumentContentProvider | |||
52 | 52 | ||
53 | async provideTextDocumentContent(_uri: vscode.Uri): Promise<string> { | 53 | async provideTextDocumentContent(_uri: vscode.Uri): Promise<string> { |
54 | const editor = vscode.window.activeTextEditor; | 54 | const editor = vscode.window.activeTextEditor; |
55 | if (editor == null) return ''; | 55 | const client = this.ctx.client |
56 | if (!editor || !client) return ''; | ||
56 | 57 | ||
57 | const position = editor.selection.active; | 58 | const position = editor.selection.active; |
58 | const request: lc.TextDocumentPositionParams = { | 59 | const request: lc.TextDocumentPositionParams = { |
59 | textDocument: { uri: editor.document.uri.toString() }, | 60 | textDocument: { uri: editor.document.uri.toString() }, |
60 | position, | 61 | position, |
61 | }; | 62 | }; |
62 | const expanded = await this.ctx.client.sendRequest<ExpandedMacro>( | 63 | const expanded = await client.sendRequest<ExpandedMacro>( |
63 | 'rust-analyzer/expandMacro', | 64 | 'rust-analyzer/expandMacro', |
64 | request, | 65 | request, |
65 | ); | 66 | ); |