Skip to content

feat(sess): resolve socket hover and completion without evaluating requests - #1952

Open
eitsupi wants to merge 2 commits into
mainfrom
feat/sess-hover-completion-resolver
Open

eitsupi wants to merge 2 commits into
mainfrom
feat/sess-hover-completion-resolver

Conversation

@eitsupi

@eitsupi eitsupi commented Nov 15, 2026 •

Copy link
Copy Markdown
Member

Summary

Follow-up to #1949. The socket session's hover and completion handlers now use the shared inspection parser and resolver instead of eval(parse(text = expr)). The request text is no longer evaluated, so hovering counter in repeat counter <- counter + 1 no longer hangs the R session, and the same applies to completion after repeat x$.

Behavior

  • Requests that are a name, a constant, or a chain of $ and @ accesses on a name give the same hover text and completion items as before. This covers data frames, lists, environments, S3 classes with $ and .DollarNames() methods, S4 slots, R6 objects, data.table, a $ b with spaces, and constants such as 1, TRUE, NULL and 0x10.
  • Other requests (function calls, assignments, multiple expressions, invalid syntax) give no result. Previously, the first of several expressions was evaluated.
  • Errors give no result, as hover did before. Completion previously let errors from listing items, such as a failing .DollarNames() method, reach the dispatcher, which replied with an error and printed a warning in the console. Both handlers now give no result, because hover and completion run without an explicit user action.
  • Interrupts are not caught, so the dispatcher still replies that the request was interrupted.

Other changes

  • The Interactive test for interrupting a slow inspection used local({ ...; Sys.sleep(30) }) as the hover request, which is now rejected. It now hovers an active binding that sleeps when read.

…quests

Switch the socket session's hover and completion handlers to the shared
inspection parser and resolver, so the request text is no longer passed to
eval(). Requests that resolve to a name, a constant, or a chain of $ and @
accesses give the same results as before; other requests give no result.
Errors are reported as no result and interrupts still propagate.

The Interactive interrupt test now makes inspection slow with an active
binding, since hover no longer evaluates arbitrary expressions.
@eitsupi
eitsupi marked this pull request as ready for review November 15, 2026 12:04
@eitsupi
eitsupi requested a review from renkun-ken November 15, 2026 12:17

This branch has not been deployed

No deployments
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