-
Notifications
You must be signed in to change notification settings - Fork 125
Description
In RStudio, rstudioapi::executeCommand("refreshFiles") refreshes your files but does not force the Files pane into view
Screen.Recording.2025-08-04.at.2.30.51.PM.mov
In Positron, it does currently force the File Explorer into view
Screen.Recording.2025-08-04.at.2.34.47.PM.mov
This results in unexpected jerkiness when rstudioapi::executeCommand("refreshFiles") is used from other helpers, like when accepting a snapshot change. I don't expect to have the file explorer be forced into view here.
Screen.Recording.2025-08-04.at.2.36.05.PM.mov
Annoying enough to make @hadley avoid this in testthat r-lib/testthat#2167
Here's the action we are using from ark:
positron/src/vs/workbench/contrib/files/browser/views/explorerView.ts
Lines 1041 to 1067 in 3c3ebf8
| registerAction2(class extends Action2 { | |
| constructor() { | |
| super({ | |
| id: 'workbench.files.action.refreshFilesExplorer', | |
| title: nls.localize2('refreshExplorer', "Refresh Explorer"), | |
| f1: true, | |
| icon: Codicon.refresh, | |
| menu: { | |
| id: MenuId.ViewTitle, | |
| group: 'navigation', | |
| when: ContextKeyExpr.equals('view', VIEW_ID), | |
| order: 30, | |
| }, | |
| metadata: { | |
| description: nls.localize2('refreshExplorerMetadata', "Forces a refresh of the Explorer.") | |
| }, | |
| precondition: ExplorerFindProviderActive.negate() | |
| }); | |
| } | |
| async run(accessor: ServicesAccessor): Promise<void> { | |
| const viewsService = accessor.get(IViewsService); | |
| const explorerService = accessor.get(IExplorerService); | |
| await viewsService.openView(VIEW_ID); | |
| await explorerService.refresh(); | |
| } | |
| }); |
It's likely this openView() call pulling the file explorer into view
| await viewsService.openView(VIEW_ID); |
This is also tied to the little refresh button within the File Explorer itself, so we don't want to mess with this directly.
We could create a new action or command that is very tightly scoped (we don't need the menu or icon bits, and probably can drop other things) that doesn't perform the openView() call and use that in ark. Tough part is coming up with a good name.