feature: Add a UnindexedProject notification and a corresponding setting.

This commit is contained in:
David Barsky 2023-11-07 16:26:32 -05:00
parent ca44e1ee9f
commit 6330b028b3
14 changed files with 262 additions and 8 deletions

View file

@ -234,6 +234,23 @@ export class Ctx implements RustAnalyzerExtensionApi {
this.outputChannel!.show();
}),
);
this.pushClientCleanup(
this._client.onNotification(ra.unindexedProject, async (params) => {
if (this.config.discoverProjectRunner) {
const command = `${this.config.discoverProjectRunner}.discoverWorkspaceCommand`;
log.info(`running command: ${command}`);
const uris = params.textDocuments.map((doc) =>
vscode.Uri.parse(doc.uri, true),
);
const projects: JsonProject[] = await vscode.commands.executeCommand(
command,
uris,
);
this.setWorkspaces(projects);
await this.notifyRustAnalyzer();
}
}),
);
}
return this._client;
}