mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-08-23 20:04:21 +00:00
Add a workspace config-based approach to reloading discovered projects.
This commit is contained in:
parent
91371494ee
commit
8d9bff0c74
4 changed files with 54 additions and 23 deletions
|
@ -758,14 +758,20 @@ export function addProject(ctx: CtxInit): Cmd {
|
|||
|
||||
const workspaces: JsonProject[] = await Promise.all(
|
||||
vscode.workspace.workspaceFolders!.map(async (folder): Promise<JsonProject> => {
|
||||
return discoverWorkspace(vscode.workspace.textDocuments, discoverProjectCommand, {
|
||||
const rustDocuments = vscode.workspace.textDocuments.filter(isRustDocument);
|
||||
return discoverWorkspace(rustDocuments, discoverProjectCommand, {
|
||||
cwd: folder.uri.fsPath,
|
||||
});
|
||||
})
|
||||
);
|
||||
|
||||
await ctx.client.sendRequest(ra.addProject, {
|
||||
project: workspaces,
|
||||
ctx.addToDiscoveredWorkspaces(workspaces);
|
||||
|
||||
// this is a workaround to avoid needing writing the `rust-project.json` into
|
||||
// a workspace-level VS Code-specific settings folder. We'd like to keep the
|
||||
// `rust-project.json` entirely in-memory.
|
||||
await ctx.client?.sendNotification(lc.DidChangeConfigurationNotification.type, {
|
||||
settings: "",
|
||||
});
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue