Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit 7b8acaa

Browse files
committed
specify zero-based numbers in error message
1 parent e883e8a commit 7b8acaa

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

langserver/ast.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ func offsetForPosition(contents []byte, p lsp.Position) (offset int, valid bool,
2323
return offset, true, ""
2424
}
2525
if (line == p.Line && col > p.Character) || line > p.Line {
26-
return 0, false, fmt.Sprintf("character %d is beyond line %d boundary", p.Character, p.Line)
26+
return 0, false, fmt.Sprintf("character %d (zero-based) is beyond line %d boundary (zero-based)", p.Character, p.Line)
2727
}
2828
offset++
2929
if b == '\n' {
@@ -37,7 +37,7 @@ func offsetForPosition(contents []byte, p lsp.Position) (offset int, valid bool,
3737
return offset, true, ""
3838
}
3939
if line == 0 {
40-
return 0, false, fmt.Sprintf("character %d is beyond first line boundary", p.Character)
40+
return 0, false, fmt.Sprintf("character %d (zero-based) is beyond first line boundary", p.Character)
4141
}
4242
return 0, false, fmt.Sprintf("file only has %d lines", line+1)
4343
}

0 commit comments

Comments
 (0)