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.
Problem
On hover, VS tries to type-check the word under the cursor. Unfortunately, it was unaware of where in the code it was, so it would look up words in the middle of strings, comments, etc. Also see #1.
Fix
I think that the ideal fix would be to go through the whole document once and map the ranges of all the non-code blocks. That's not too hard, the tricky bit is maintaining that map after every single document update. (Incidentally, that's a similar problem to handling the semantic highlighting.) But I'm still not sure the best way to map
TextDocumentContentChangeEvent
s to those ranges. Hmm.So, the short term fix is just to walk the document up to the requested position on every hover. My thoroughly unscientific benchmark showed that it was taking up to 65 ms on the longest file I could find in the Idris2 repo, Vect.idr, which is 900 lines. I wasn't able to perceive the difference, as the Hover has a built in delay anyway.