Repository navigation
feat(sess): resolve socket hover and completion without evaluating requests - #1952
Conversation
…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.
renkun-ken
left a comment
There was a problem hiding this comment.
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.
Summary
Follow-up to #1949. The socket session's
hoverandcompletionhandlers now use the shared inspection parser and resolver instead ofeval(parse(text = expr)). The request text is no longer evaluated, so hoveringcounterinrepeat counter <- counter + 1no longer hangs the R session, and the same applies to completion afterrepeat x$.Behavior
$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 $ bwith spaces, and constants such as1,TRUE,NULLand0x10..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.Other changes
local({ ...; Sys.sleep(30) })as the hover request, which is now rejected. It now hovers an active binding that sleeps when read.