From 6694b286c37fa309be88cb4d0bd0e6c0479f7796 Mon Sep 17 00:00:00 2001 From: Hariom Verma Date: Wed, 27 Mar 2024 15:50:51 +0530 Subject: [PATCH] Don't shift line for build errors This is already handles in the gno binary itself. --- internal/lsp/build.go | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/internal/lsp/build.go b/internal/lsp/build.go index 8448421..a39cc87 100644 --- a/internal/lsp/build.go +++ b/internal/lsp/build.go @@ -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, @@ -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 {