diff options
author | Aleksey Kladov <[email protected]> | 2019-12-31 17:14:00 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-12-31 17:32:17 +0000 |
commit | 087af54069d34eef5197e04d64ac322d9ee98085 (patch) | |
tree | 3a6e4b1884930c07bd800a771ffd777d7a866b11 /editors/code/src/commands/expand_macro.ts | |
parent | 0849f7001cac6af93ce9e9356f8c21881bbe34c5 (diff) |
Refactor server lifecycle
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 | ); |