Skip to content

Commit 0dcd912

Browse files
committed
Preserve project-local inspect metadata (#5054)
1 parent 53df13e commit 0dcd912

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

src/CodeIndex/Cli/DbPathResolver.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,21 @@ private static string ComputeWorkspaceHash(string workspacePath)
202202
return null;
203203
}
204204

205+
/// <summary>
206+
/// Resolve only the project-local DB layout override while preserving a project-root
207+
/// value already captured by the caller's SQLite snapshot.
208+
/// caller の SQLite snapshot で取得済みの project root を維持しつつ、
209+
/// project-local DB layout の override だけを解決する。
210+
/// </summary>
211+
internal static string? ResolveProjectLocalRootForQuery(
212+
string dbPath,
213+
bool dbPathExplicit,
214+
string? indexedProjectRoot)
215+
{
216+
var fullDbPath = Path.GetFullPath(NormalizeDbPath(dbPath));
217+
return TryResolveProjectLocalRoot(fullDbPath, dbPath, dbPathExplicit, indexedProjectRoot);
218+
}
219+
205220
/// <summary>
206221
/// Normalize a file query path against the indexed project root when the DB exposes one.
207222
/// If the caller supplied an absolute path under the indexed root, convert it to the

src/CodeIndex/Cli/WorkspaceMetadataEnricher.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,11 @@ private static RuntimeWorkspaceMetadata ResolveRuntime(
194194
bool projectRootSnapshotCaptured = false)
195195
{
196196
var projectRoot = projectRootSnapshotCaptured
197-
? capturedProjectRoot
197+
? DbPathResolver.ResolveProjectLocalRootForQuery(
198+
dbPath,
199+
dbPathExplicit,
200+
capturedProjectRoot)
201+
?? capturedProjectRoot
198202
: capturedProjectRoot ?? DbPathResolver.ResolveProjectRootForQuery(dbPath, dbPathExplicit);
199203
if (projectRoot == null)
200204
return new(null, null, null, null);

0 commit comments

Comments
 (0)