Skip to content

Commit

Permalink
chore: add comments about TextEdits positions adjustements
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez committed Dec 17, 2024
1 parent f4b2e7a commit 898a5da
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/goanalysis/runners.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ func buildIssues(diags []Diagnostic, linterNameBuilder func(diag *Diagnostic) st
end = edit.Pos
}

// To be applied the positions need to be "adjusted" based on the file.
// This is the difference between the "displayed" positions and "effective" positions.
nsf.TextEdits = append(nsf.TextEdits, analysis.TextEdit{
Pos: token.Pos(diag.File.Offset(edit.Pos)),
End: token.Pos(diag.File.Offset(end)),
Expand Down

0 comments on commit 898a5da

Please sign in to comment.