Skip to content
This repository has been archived by the owner on May 29, 2024. It is now read-only.

Commit

Permalink
Don't shift line for build errors
Browse files Browse the repository at this point in the history
This is already handles in the gno binary itself.
  • Loading branch information
harry-hov committed Mar 27, 2024
1 parent afec8a8 commit 6694b28
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions internal/lsp/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,17 +110,9 @@ func findError(file *GnoFile, fname string, line, col int, msg string, tool stri
needle := parens.ReplaceAllString(msg, "")
tokens := strings.Fields(needle)

shiftedLine := line
if tool == "build" {
// The generated Go file has 4 lines of header information.
//
// +1 for zero-indexing.
shiftedLine = line - 4
}

errorInfo := ErrorInfo{
FileName: strings.TrimPrefix(GoToGnoFileName(filepath.Base(fname)), "."),
Line: shiftedLine,
Line: line,
Column: col,
Span: []int{0, 0},
Msg: msg,
Expand All @@ -129,7 +121,7 @@ func findError(file *GnoFile, fname string, line, col int, msg string, tool stri

lines := strings.SplitAfter(string(file.Src), "\n")
for i, l := range lines {
if i != shiftedLine-1 { // zero-indexed
if i != line-1 { // zero-indexed
continue
}
for _, token := range tokens {
Expand Down

0 comments on commit 6694b28

Please sign in to comment.