vscode
vscode copied to clipboard
Docs > when clause contexts > view identifiers: workbench.view.scm is not correct, workbench.scm is
Does this issue occur when all extensions are disabled?: Yes
- VS Code Version: 1.73.1, Electron 19.0.17, Node 16.14.2, Chromium 102.0.5005.167,
- OS Version: Windows_NT x64 10.0.22000
Referring to this: https://code.visualstudio.com/api/references/when-clause-contexts#activefocused-view-or-panel-when-clause-context
When clause contexts' Source Control's view identifier is not workbench.view.scm
as docs state, but is actually workbench.scm
. I discovered this while writing
key binding with focusedView == workbench.view.scm
, it would never be true,
but it works correctly with focusedView == workbench.scm
. I got this value from
Developer: Inspect context keys command.
Steps to Reproduce:
- Try to create any keybind with focusedView == 'workbench.view.scm', shouldn't work Try adding this for example:
{
"key": "escape",
"command": "workbench.explorer.fileView.focus",
"when": "focusedView == workbench.view.scm"
},
- Change when clause to focusedView == 'workbench.scm' should work now
{
"key": "escape",
"command": "workbench.explorer.fileView.focus",
"when": "focusedView == workbench.scm"
},
Looks like a "typo" while writing the docs, or internally view identifiers changed and docs were not updated.
I did not check if other IDs are correct, like workbench.view.search
etc,
they might be wrong in the same way as well.
Adding @gregvanl, @sandy081, @sbatten to confirm whether this is indeed a documentation bug or an issue with setting focusedView
.
This seems to be a doc bug - because I see the view id in our code is workbench.scm
here - https://github.com/microsoft/vscode/blob/f126d786635872b21ff0890c9e7108fcf54e2ab3/src/vs/workbench/contrib/scm/common/scm.ts#L18
export const VIEWLET_ID = 'workbench.view.scm';
export const VIEW_PANE_ID = 'workbench.scm';
Yeah, someone must've mistaken these two
@sandy081, what confuses me is that other identifiers on that page also point to viewlets.
https://github.com/microsoft/vscode/blob/8b939ad54bcd614386e16ee0a84f858356ceb036/src/vs/workbench/contrib/extensions/common/extensions.ts#L22-L23
Could there be other identifiers on that page that are incorrect?
Agree with Lad, I haven't made progress on this nor the vscode-docs issue and PR until I understand when each ID should be used and whether other views have separate view and pane IDs.
workbench.view.blah
is usually the command ID for opening the view, for example:
I see the confusion here - we have view containers (viewlets/panels) and views. There are following three contexts
-
activeViewlet
- which expects viewlet/view container id -
activePanel
- which expects panel/view container id -
focusedView
- which expects view id
Probably we shall update the doc by listing viewlets and views ids.
Thanks @sandy081 for the clarifications. Could you please work with @gregvanl to update the page? Thank you!