Repository navigation
Drop position mappings when a document is closed - #5170
Merged
crtschin merged 1 commit intoNov 9, 2026
Merged
Conversation
crtschin
force-pushed
the
crtschin/drop-position-mapping-on-close
branch
from
November 7, 2026 17:42
52d31a9 to
92099fe
Compare
crtschin
marked this pull request as ready for review
November 7, 2026 19:49
crtschin
force-pushed
the
crtschin/drop-position-mapping-on-close
branch
from
November 7, 2026 19:49
92099fe to
2f26237
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #5163.
Some quick context.
The main idea here is that the version number allows the server to stay in sync with the client even if it may be lagging behind in the file's contents, i.e. HLS uses the old contents of the file to answer a hover request and then uses the version numbers to then translate the hover request to what's active in the buffer. Lastly there's
The behavior in the issue is due to the editor, on having previously opened, edited and closed a file ending at$V_n$ , re-opens that file at version $V_0$ . HLS stores the position mapping from the previous edit loop. So when the editor re-opens the file at version $V_0$ , HLS will incorrectly use the translation from $V_0 \rightarrow V_n$ on the editor requests.
This PR fixes it by deleting the position mappings for the file, when we receive a
didClose.