Skip to content

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

Merged
eitsupi merged 2 commits into
mainfrom
feat/sess-hover-completion-resolver
Nov 16, 2026
Merged

eitsupi merged 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

@renkun-ken renkun-ken left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at 8dceb33. No blocking findings.

The socket handlers consistently use the shared parser/resolver, rejecting control flow, calls, assignments and multiple expressions before reading bindings while preserving supported name, constant and member inspection. The error-to-no-result wrappers leave interrupts for the dispatcher, and the revised active-binding test verifies that requests remain usable both before and after an inspection timeout.

Validation: local extension build and TypeScript compilation passed; all 1,498 sess tinytest results passed; the targeted Interactive slow-inspection interrupt/recovery regression passed. Local runtime: macOS, Node 26.13.1, R 4.6.1 and arf 0.7.0. All 13 hosted checks are successful on this head.

@eitsupi
eitsupi merged commit 599e78f into main Nov 16, 2026
30 of 34 checks passed
@eitsupi
eitsupi deleted the feat/sess-hover-completion-resolver branch November 16, 2026 08:38
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.

2 participants