microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
160.95k stars 28.24k forks source link

Notebook: status bar is not floating window aware #210383

Open bpasero opened 3 months ago

bpasero commented 3 months ago

This is a missing adoption when notebooks became floating window capable. Notice how the status bar entry appears in the main window and not the floating window:

Screenshot 2024-04-15 at 11 56 20

We have had a similar issue with the text editor status bar and solved it by instantiating it per-window:

https://github.com/microsoft/vscode/blob/b41db6119374a19f030f194ac859733a95eb7009/src/vs/workbench/browser/parts/editor/editorStatus.ts#L895-L904

I think a similar approach would work for notebooks too.

The key for this to work is that you get a scoped IEditorService in the onDidCreateAuxiliaryEditorPart that allows you to listen only to editor change events in the respective window. Consequently, you use a main-window scoped editor service for the main-window status bar:

https://github.com/microsoft/vscode/blob/b41db6119374a19f030f194ac859733a95eb7009/src/vs/workbench/browser/parts/editor/editorStatus.ts#L897

Let me know if you have questions, but I think its easy to copy what we do for editor status here.

bpasero commented 1 month ago

When I reload the window with a floating notebook, the status bar does not appear (macOS):

image