diff options
| author | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-09-26 20:53:04 -0400 |
|---|---|---|
| committer | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-09-26 20:54:17 -0400 |
| commit | 297c9ac556008804c95f92de3381925787655b10 (patch) | |
| tree | e16e99f76f64011c4fefcaf4b4c12c395ab3a5d2 /src/server/check.odin | |
| parent | be068e5dad39f502c6ed7cf6b3e64a46c9540e0d (diff) | |
Ensure the lines and columns for diagnostics are non negative
Diffstat (limited to 'src/server/check.odin')
| -rw-r--r-- | src/server/check.odin | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/server/check.odin b/src/server/check.odin index ea68066..b8f0c7c 100644 --- a/src/server/check.odin +++ b/src/server/check.odin @@ -159,8 +159,9 @@ check :: proc(paths: []string, uri: common.Uri, writer: ^Writer, config: ^common code = "checker", severity = .Error, range = { - start = {character = error.pos.column - 1, line = error.pos.line - 1}, - end = {character = error.pos.end_column - 1, line = error.pos.line - 1}, + // odin will sometimes report errors on column 0, so we ensure we don't provide a negative column/line to the client + start = {character = max(error.pos.column - 1, 0), line = max(error.pos.line - 1, 0)}, + end = {character = max(error.pos.end_column - 1, 0), line = max(error.pos.line - 1, 0)}, }, message = message, }, |