Capture selected host configuration sources
This commit is contained in:
@@ -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")}
|
||||
|
||||
Reference in New Issue
Block a user