Validate search filesystem context after selection

This commit is contained in:
2026-10-24 19:13:35 +00:00
parent f64497cb13
commit 4dc3e70877
3 changed files with 63 additions and 3 deletions

View File

@@ -79,7 +79,14 @@ func filesystemOptionDiagnostics(source Source, context *FilesystemContext) []Di
case sourceNone:
return absentFilesystemOptionDiagnostics(context)
case sourceSearch:
return absentFilesystemOptionDiagnostics(context)
if context.FS != nil {
return absentFilesystemOptionDiagnostics(context)
}
// A selected host file can derive its root; absence requires an
// explicit root. Check that compatibility only after selection.
if context.BaseDir != "" && !filepath.IsAbs(context.BaseDir) {
return []Diagnostic{optionDiagnostic(CodeOptionsInvalid, "filesystem base directory must be an absolute host path")}
}
case sourceFile:
if context.FS != nil {
return []Diagnostic{optionDiagnostic(CodeOptionsInvalid, "host file sources cannot use a native filesystem context")}