From 58b0b64178914b03ced5ff1e78adcffc7a2b9c23 Mon Sep 17 00:00:00 2001 From: NaccOll Date: Mon, 11 Aug 2025 00:17:06 +0800 Subject: [PATCH 1/2] fix: Use workspacePath from instance if available in CodeIndexManager and QdrantVectorStore --- src/services/code-index/manager.ts | 4 ++-- src/services/code-index/vector-store/qdrant-client.ts | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/services/code-index/manager.ts b/src/services/code-index/manager.ts index 1257b747c6..c34d91424c 100644 --- a/src/services/code-index/manager.ts +++ b/src/services/code-index/manager.ts @@ -132,7 +132,7 @@ export class CodeIndexManager { } // 3. Check if workspace is available - const workspacePath = getWorkspacePath() + const workspacePath = this.workspacePath || getWorkspacePath() if (!workspacePath) { this._stateManager.setSystemState("Standby", "No workspace folder open") return { requiresRestart } @@ -305,7 +305,7 @@ export class CodeIndexManager { ) const ignoreInstance = ignore() - const workspacePath = getWorkspacePath() + const workspacePath = this.workspacePath if (!workspacePath) { this._stateManager.setSystemState("Standby", "") diff --git a/src/services/code-index/vector-store/qdrant-client.ts b/src/services/code-index/vector-store/qdrant-client.ts index 50f39666c4..674434981a 100644 --- a/src/services/code-index/vector-store/qdrant-client.ts +++ b/src/services/code-index/vector-store/qdrant-client.ts @@ -17,6 +17,7 @@ export class QdrantVectorStore implements IVectorStore { private client: QdrantClient private readonly collectionName: string private readonly qdrantUrl: string = "http://localhost:6333" + private readonly workspaceRoot: string /** * Creates a new Qdrant vector store @@ -29,6 +30,7 @@ export class QdrantVectorStore implements IVectorStore { // Store the resolved URL for our property this.qdrantUrl = parsedUrl + this.workspaceRoot = workspacePath try { const urlObj = new URL(parsedUrl) @@ -445,7 +447,7 @@ export class QdrantVectorStore implements IVectorStore { return } - const workspaceRoot = getWorkspacePath() + const workspaceRoot = this.workspaceRoot || getWorkspacePath() // Build filters using pathSegments to match the indexed fields const filters = filePaths.map((filePath) => { From 27cd7ebbb25c6e3b433a1434568c86ff4b8b2534 Mon Sep 17 00:00:00 2001 From: NaccOll Date: Wed, 13 Aug 2025 08:12:08 +0800 Subject: [PATCH 2/2] Use workspacePath from instance in CodeIndexManager and QdrantVectorStore --- src/services/code-index/manager.ts | 3 +-- src/services/code-index/vector-store/qdrant-client.ts | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/services/code-index/manager.ts b/src/services/code-index/manager.ts index c34d91424c..c4ebd9557d 100644 --- a/src/services/code-index/manager.ts +++ b/src/services/code-index/manager.ts @@ -1,5 +1,4 @@ import * as vscode from "vscode" -import { getWorkspacePath } from "../../utils/path" import { ContextProxy } from "../../core/config/ContextProxy" import { VectorStoreSearchResult } from "./interfaces" import { IndexingState } from "./interfaces/manager" @@ -132,7 +131,7 @@ export class CodeIndexManager { } // 3. Check if workspace is available - const workspacePath = this.workspacePath || getWorkspacePath() + const workspacePath = this.workspacePath if (!workspacePath) { this._stateManager.setSystemState("Standby", "No workspace folder open") return { requiresRestart } diff --git a/src/services/code-index/vector-store/qdrant-client.ts b/src/services/code-index/vector-store/qdrant-client.ts index 674434981a..eccdaf6e6e 100644 --- a/src/services/code-index/vector-store/qdrant-client.ts +++ b/src/services/code-index/vector-store/qdrant-client.ts @@ -17,7 +17,7 @@ export class QdrantVectorStore implements IVectorStore { private client: QdrantClient private readonly collectionName: string private readonly qdrantUrl: string = "http://localhost:6333" - private readonly workspaceRoot: string + private readonly workspacePath: string /** * Creates a new Qdrant vector store @@ -30,7 +30,7 @@ export class QdrantVectorStore implements IVectorStore { // Store the resolved URL for our property this.qdrantUrl = parsedUrl - this.workspaceRoot = workspacePath + this.workspacePath = workspacePath try { const urlObj = new URL(parsedUrl) @@ -447,7 +447,7 @@ export class QdrantVectorStore implements IVectorStore { return } - const workspaceRoot = this.workspaceRoot || getWorkspacePath() + const workspaceRoot = this.workspacePath // Build filters using pathSegments to match the indexed fields const filters = filePaths.map((filePath) => {