Skip to content

getStartPosition and getEndPosition can return Diagnostic.NOPOS.#348

Open
brown wants to merge 1 commit intogeorgewfraser:masterfrom
brown:bug-fix-nopos-end
Open

getStartPosition and getEndPosition can return Diagnostic.NOPOS.#348
brown wants to merge 1 commit intogeorgewfraser:masterfrom
brown:bug-fix-nopos-end

Conversation

@brown
Copy link
Contributor

@brown brown commented Mar 11, 2026

The code currently compares Diagnostic.getStartPosition and getEndPosition to -1. The documentation for the methods says both return NOPOS, which of course happens to be -1.

Anyway, I think I changed the code because I was seeing cases where the end position for an error is NOPOS. In that case I map NOPOS to contents.length() so the error is correctly displayed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant