Capture selected host configuration sources

This commit is contained in:
2026-11-18 00:41:44 +00:00
parent a9c72c1b67
commit a3c77f32f2
5 changed files with 178 additions and 15 deletions

View File

@@ -36,6 +36,7 @@ type Source struct {
searchApp string
searchRequired bool
searchIssues []string
captured *capturedHostSource
}
type sourceKind uint8
@@ -227,6 +228,15 @@ func readSource(source Source, sourceID string, limits sourceLimits) (sourceRead
var input io.Reader
switch source.kind {
case sourceFile:
if source.captured != nil {
info.Path = source.captured.mainPath
if source.captured.bytes > limit {
return sourceRead{info: info}, []Diagnostic{sourceDiagnostic(CodeSourceLimitExceeded, sourceID, "source exceeds the configured byte limit")}
}
owned := document.Clone(source.captured.document)
setDocumentSourceID(owned, sourceID)
return sourceRead{document: owned, bytes: source.captured.bytes, info: info}, nil
}
absolute, err := filepath.Abs(source.path)
if err != nil {
return sourceRead{info: info}, []Diagnostic{sourceDiagnostic(CodeSourceRead, sourceID, "source path could not be resolved")}