Preserve matched record metadata after resolution
This commit is contained in:
@@ -162,6 +162,13 @@ func documentWithMetadataLocations(root *document.Node, metadata Metadata, fallb
|
||||
}
|
||||
var lookup *documentLookup
|
||||
fallbackLocation := func(path Path) (document.Location, bool) {
|
||||
if model := metadata.historyEvidence(); model != nil && model.resolutionPayload != nil {
|
||||
var matched bool
|
||||
path, matched = model.resolutionPayload.correspondence.entryPath(path)
|
||||
if !matched {
|
||||
return document.Location{}, false
|
||||
}
|
||||
}
|
||||
if lookup == nil {
|
||||
lookup = buildDocumentLookup(fallbackRoot)
|
||||
}
|
||||
@@ -255,6 +262,13 @@ func metadataFieldLocation(metadata Metadata, path Path, origin Origin) (documen
|
||||
return location, true
|
||||
}
|
||||
if model := metadata.historyEvidence(); model != nil {
|
||||
if model.resolutionPayload != nil {
|
||||
var matched bool
|
||||
path, matched = model.resolutionPayload.correspondence.entryPath(path)
|
||||
if !matched {
|
||||
return document.Location{}, false
|
||||
}
|
||||
}
|
||||
location, ok := model.latestHistoricalLocation(path)
|
||||
if ok {
|
||||
return document.Location{SourceID: location.SourceID, Line: location.Line, Column: location.Column}, true
|
||||
|
||||
Reference in New Issue
Block a user