Preserve matched record metadata after resolution

This commit is contained in:
2026-11-02 14:47:52 +00:00
parent c61597d137
commit 4549fbaeef
4 changed files with 92 additions and 3 deletions

View File

@@ -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