mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 21:35:20 +00:00
Refactor server lifecycle
This commit is contained in:
parent
0849f7001c
commit
087af54069
12 changed files with 216 additions and 199 deletions
|
@ -10,7 +10,10 @@ export interface SourceChange {
|
|||
}
|
||||
|
||||
export async function applySourceChange(ctx: Ctx, change: SourceChange) {
|
||||
const wsEdit = ctx.client.protocol2CodeConverter.asWorkspaceEdit(
|
||||
const client = ctx.client;
|
||||
if (!client) return
|
||||
|
||||
const wsEdit = client.protocol2CodeConverter.asWorkspaceEdit(
|
||||
change.workspaceEdit,
|
||||
);
|
||||
let created;
|
||||
|
@ -32,10 +35,10 @@ export async function applySourceChange(ctx: Ctx, change: SourceChange) {
|
|||
const doc = await vscode.workspace.openTextDocument(toOpenUri);
|
||||
await vscode.window.showTextDocument(doc);
|
||||
} else if (toReveal) {
|
||||
const uri = ctx.client.protocol2CodeConverter.asUri(
|
||||
const uri = client.protocol2CodeConverter.asUri(
|
||||
toReveal.textDocument.uri,
|
||||
);
|
||||
const position = ctx.client.protocol2CodeConverter.asPosition(
|
||||
const position = client.protocol2CodeConverter.asPosition(
|
||||
toReveal.position,
|
||||
);
|
||||
const editor = vscode.window.activeTextEditor;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue