mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-10 02:12:40 +00:00
Refactor server lifecycle
This commit is contained in:
parent
0849f7001c
commit
087af54069
12 changed files with 216 additions and 199 deletions
|
@ -52,14 +52,15 @@ class TextDocumentContentProvider
|
|||
|
||||
async provideTextDocumentContent(_uri: vscode.Uri): Promise<string> {
|
||||
const editor = vscode.window.activeTextEditor;
|
||||
if (editor == null) return '';
|
||||
const client = this.ctx.client
|
||||
if (!editor || !client) return '';
|
||||
|
||||
const position = editor.selection.active;
|
||||
const request: lc.TextDocumentPositionParams = {
|
||||
textDocument: { uri: editor.document.uri.toString() },
|
||||
position,
|
||||
};
|
||||
const expanded = await this.ctx.client.sendRequest<ExpandedMacro>(
|
||||
const expanded = await client.sendRequest<ExpandedMacro>(
|
||||
'rust-analyzer/expandMacro',
|
||||
request,
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue