Send detached files info to server via init params

This commit is contained in:
Kirill Bulatov 2021-05-23 16:22:13 +03:00
parent d9a5490646
commit b3383b0661
3 changed files with 27 additions and 6 deletions

View file

@ -49,7 +49,7 @@ async function tryActivate(context: vscode.ExtensionContext) {
if (workspaceFolder === undefined) {
let rustDocuments = vscode.workspace.textDocuments.filter(document => isRustDocument(document));
if (rustDocuments.length > 0) {
ctx = await Ctx.create(config, context, serverPath);
ctx = await Ctx.create(config, context, serverPath, { kind: 'Detached files', files: rustDocuments });
} else {
throw new Error("no rust files are opened");
}
@ -58,7 +58,7 @@ async function tryActivate(context: vscode.ExtensionContext) {
// registers its `onDidChangeDocument` handler before us.
//
// This a horribly, horribly wrong way to deal with this problem.
ctx = await Ctx.create(config, context, serverPath, workspaceFolder.uri.fsPath);
ctx = await Ctx.create(config, context, serverPath, { kind: "Workspace Folder", folder: workspaceFolder.uri });
ctx.pushCleanup(activateTaskProvider(workspaceFolder, ctx.config));
}
await initCommonContext(context, ctx);