Follow-up from #297 and PR #300.
Problem
#297 maps diagnostic related locations to LSP relatedInformation, but the
mapping uses the current document's URI for every related location
(relatedInformationFromLang in internal/lsp/diagnostics.go). That is correct
for the single-document check the server runs today, where conflicts are
in-file, but a related location whose File differs from the open document
points at the wrong URI.
Relevant code:
internal/lsp/diagnostics.go: relatedInformationFromLang (uses one uri)
internal/lsp/notifications.go: publishDiagnostics (single-document check)
internal/lang/diagnostic.go: RelatedLocation.File
Scope
Resolve cross-file related locations to their own file:// URI and compute the
range against the related file's content (loading it when the related File
differs from the open document), so a conflict that spans two files links each
location to the right file.
Acceptance Criteria
- A related location with a different
File is emitted with that file's URI and
a range computed against that file.
- Same-file related locations keep current behavior.
- A test covers a cross-file related location URI.
Verification
Follow-up from #297 and PR #300.
Problem
#297 maps diagnostic related locations to LSP
relatedInformation, but themapping uses the current document's URI for every related location
(
relatedInformationFromLangininternal/lsp/diagnostics.go). That is correctfor the single-document check the server runs today, where conflicts are
in-file, but a related location whose
Filediffers from the open documentpoints at the wrong URI.
Relevant code:
internal/lsp/diagnostics.go:relatedInformationFromLang(uses oneuri)internal/lsp/notifications.go:publishDiagnostics(single-document check)internal/lang/diagnostic.go:RelatedLocation.FileScope
Resolve cross-file related locations to their own
file://URI and compute therange against the related file's content (loading it when the related
Filediffers from the open document), so a conflict that spans two files links each
location to the right file.
Acceptance Criteria
Fileis emitted with that file's URI anda range computed against that file.
Verification
go test ./internal/lsp