Improve speed and responsiveness for code entered or sent to the Console - #15078
Open
jmcphers wants to merge 18 commits into
Open
Improve speed and responsiveness for code entered or sent to the Console#15078jmcphers wants to merge 18 commits into
jmcphers wants to merge 18 commits into
Conversation
|
E2E Tests 🚀 Why these tags?
More on automatic tags from changed files. Warning This PR touches a Positron directory that isn't mapped in test-tag-paths-map.json: |
2 tasks
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.
Fixes #8915
Summary
This PR holistically addresses a number of performance and responsiveness problems around running and sending code to the console, especially in Workbench and Remote SSH scenarios.
It has the following goals:
Previously, pressing Enter in the Console triggered up to three separate
is_complete_requestroundtrips to the kernel (Enter handler,enqueueCode, and the pending-input queue drain), each of which is especially costly on remote configurations, and none of which gave the user any feedback or a way to cancel while it was in flight.This PR introduces a single submission entry point (
submitCode) on the Console instance that chooses the cheapest available completeness strategy:InputBoundaryProvider(R does, via Ark), the input is split locally over LSP with no kernel queue. Complete statements are executed and queued individually as pre-verified fragments (so the queue drain no longer re-checks each one); an incomplete tail yields a continuation prompt; an invalid fragment executes the whole input as-is so the interpreter surfacesthe error.
Unprocessedmode (Flow 2) - when no provider matches (e.g. Python), code is sent with a newUnprocessedexecution mode. The supervisor (running in the possibly-remote extension host) performs theis_complete_requestitself beforeexecute_request, eliminating the client-to-remote roundtrip. Incomplete code rejects withCodeIncompleteErrorand the Console shows the continuation prompt.console.promptWhenIncompletedisabled, code runs immediately with no completeness check at all. This makes execution very snappy for people who don't want prompting.When the code is sent to the console from the Editor via a statement range provider, we now skip the completeness check entirely (Flow 3), making this common path more responsive.
Submission is now observable state on the Console instance with debounced visuals: at 400ms the input dims slightly and a green barber pole appears; at 1000ms a "Submitting..." overlay with a Cancel button appears bottom-right.
The action bar stop button and Ctrl+C both cancel the in-flight submission (which also aborts the supervisor-side check for Flow 2). The
Unprocessedmode is an internal wire detail only - accepted executions are reported asInteractiveinonDidExecuteCode.To support this,
LanguageRuntimeSession.execute()is now awaitable end to end (Thenable<void> | void) so a completeness rejection can propagate back across the RPC boundary, identified byerror.name(
CodeIncompleteError/ExecutionCancelledError).Release Notes
New Features
console.promptWhenIncompletesetting to run submitted code immediately without a completeness check.Bug Fixes
Validation Steps
@:console @:ark
R (input boundary provider path):
print("a") <CR> Sys.sleep(4) <CR> print("B")both execute with interleaved echo; the second appears as a dimmed queued pending-input item, then runs.f <- function(-> a continuation prompt appears and nothing executes. Confirm the barber pole does NOT flicker for fast checks (< 400ms).Python (
Unprocessedpath):def f():and press Enter -> a continuation prompt appears.Submission feedback / cancel (any language, simulate a slow check):
Setting / regression:
console.promptWhenIncompletetofalse-> incomplete input submits immediately and the interpreter reports the syntax error; no dim/barber pole appears.