Repository navigation
fix(interactive): create a session from a picker for the folder it listed sessions for - #1992
Conversation
…sted sessions for With no active editor, the Connect picker listed sessions with the first workspace folder's arf, but kept no resource. Choosing New persistent R session then read the active editor again, so a file opened in another folder while the picker was open decided the arf that was offered. The Connect picker and the execution target picker now resolve that folder when they open, and use it for both listing and creation.
renkun-ken
left a comment
There was a problem hiding this comment.
I reproduced the focus change on the base commit with a mocked two-folder VS Code workspace. Both Connect and Run R code listed sessions with the first folder’s arf, then offered the second folder’s arf for creation. At 1ff2675, both pickers use the first folder’s arf for both steps. A picker opened from an R file also keeps that file’s folder when focus moves. All 10 CI checks passed.
| * resource's, or else the first folder. Its arf setting applies, as its | ||
| * directory does. | ||
| */ | ||
| /** |
There was a problem hiding this comment.
Small documentation nit. Adding pickerResource() here leaves two JSDoc blocks above it. Moving the existing “The workspace folder…” block directly above sessionFolder() would restore that method’s hover documentation.
| sandbox.stub(vscode.window, 'activeTextEditor').get(() => active); | ||
| const picker = sandbox.stub(vscode.window, 'showQuickPick'); | ||
| picker.onFirstCall().callsFake((async (items: unknown) => { | ||
| const choices = (await items) as (vscode.QuickPickItem & { create?: boolean })[]; |
There was a problem hiding this comment.
Optional test improvement. The first picker’s discovery warning already includes the arf path it checked. Asserting that its detail contains missing[0] here would catch a future change that makes discovery use the wrong folder even if creation still uses the right one.
…the folder it creates them for The test now also checks that listing reported the first folder's arf, so a change that lists sessions for another folder than creation uses fails it. The documentation of sessionFolder() is back above that method, after pickerResource() was inserted below it.
With no active editor, the Connect picker listed sessions with the first workspace folder's arf but kept no resource. Choosing New persistent R session then read the active editor again, so a file opened in another folder while the picker was open decided which arf was offered.
The Connect picker and the execution target picker now resolve that folder when they open, and use it for both listing and creating sessions.