Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

feat: more precise error position (#13601)

h3n4la964f5be10b1
diff --git a/backend/api/lsp/fs_handler.go b/backend/api/lsp/fs_handler.go
index 12c787cf80..7faf7d8168 100644
--- a/backend/api/lsp/fs_handler.go
+++ b/backend/api/lsp/fs_handler.go
@@ -158,12 +158,15 @@ func collectDiagnostics(err *base.SyntaxError) []lsp.Diagnostic {
syntaxDiagnostic := lsp.Diagnostic{
Range: lsp.Range{
Start: lsp.Position{
- Line: err.Line,
+ // Convert to zero-based.
+ Line: err.Line - 1,
Character: err.Column,
},
End: lsp.Position{
- Line: err.Line,
- Character: err.Column,
+ // Convert to zero-based.
+ Line: err.Line - 1,
+ // The end position is exclusive.
+ Character: err.Column + 1,
},
},
Severity: lsp.Error,