about summary refs log tree commit diff
path: root/editors/code/src/ctx.ts
diff options
context:
space:
mode:
authorDavid Barsky <me@davidbarsky.com>2023-11-07 16:26:32 -0500
committerDavid Barsky <me@davidbarsky.com>2024-02-08 14:23:00 -0500
commit6330b028b3f4d10220170fa995aeeb0655f9e8dc (patch)
treead3606ed7fb4ba79c1df7d1f9ad70bb7b3774fcf /editors/code/src/ctx.ts
parentca44e1ee9f993d9e7a4fbb83eea3f28aaf0f0306 (diff)
feature: Add a `UnindexedProject` notification and a corresponding setting.
Diffstat (limited to 'editors/code/src/ctx.ts')
-rw-r--r--editors/code/src/ctx.ts17
1 files changed, 17 insertions, 0 deletions
diff --git a/editors/code/src/ctx.ts b/editors/code/src/ctx.ts
index 55163241c2a..01a3aca1323 100644
--- a/editors/code/src/ctx.ts
+++ b/editors/code/src/ctx.ts
@@ -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;
     }