Repository navigation
Stabilize inlay hints during incomplete edits - #787
Open
renkun-ken wants to merge 2 commits into
Open
renkun-ken wants to merge 2 commits into
renkun-ken wants to merge 2 commits into
Conversation
eitsupi
reviewed
Oct 10, 2026
eitsupi
left a comment
Member
There was a problem hiding this comment.
This review was conducted with ChatGPT.
The overall approach looks sound and should significantly improve the issue reported in REditorSupport/vscode-R#1853 without disabling inlay hints.
I noticed one edge case in inlay_hint_apply_change() that may need fixing before merging:
- When an edit ends exactly at the start of a call, the call is considered untouched. For example, replacing
x <-withobj$inx <- target(a, b)producesobj$target(a, b). The cached hints may be preserved during a subsequent parse error, even though member calls are intentionally excluded from inlay hints. - The current boundary check only handles insertions at the call's start, not replacements ending there. Could you address this case and add a regression test?
Two non-blocking suggestions:
- Since incremental edits now update and reorder the cached call index, a quick typing-performance benchmark on a large file would be useful.
- Manual verification in VS Code would help confirm that the flickering reported in #1853 is sufficiently reduced.
Otherwise, the implementation and test coverage look promising.
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.
Temporary syntax errors while typing currently clear parameter-name inlay hints across the document, making unrelated lines shift as hints disappear and reappear. Preserve the last valid call index for untouched calls, move their UTF-16 positions with incremental edits, and refresh it after successful parsing.
Discard calls intersecting an edit and conservatively invalidate following calls when comments or strings may change lexical context. Invalidate calls when inserts, replacements, or deletions ending at the callee can change its name, namespace, or member context. Retain previously resolved parameter names during parse failures, honor current hint settings and viewport ranges, and restrict Quarto/R Markdown fallback hints to omitted R cells so fresh results take precedence.
Hints for the call being edited may still disappear until it parses successfully. Visual verification of flickering in VS Code remains outstanding.
Related: REditorSupport/vscode-R#1853
Validation:
$,@,::, renamed callees, multiline replacements, and deletion joining a call to a member prefix. These fail before the boundary fix and pass afterward; whitespace replacements still preserve hints.stats::rnorm(10, 1, 2)calls, alternating insertion/deletion on the blank middle line. Median time was 2.410 ms per edit with the cached call-index update versus 0.080 ms without it, adding 2.330 ms per edit. The benchmark includes document content updates and keeps all 10,000 calls cached throughout; it excludes background parsing and editor rendering.git diff --checkpassed; no new lint findings in changed code.