@@ -102,7 +102,7 @@ function moveCurrentEditorContextToFront(editorContext: IEditorCommandsContext,
102
102
return multiEditorContext ;
103
103
}
104
104
105
- function getEditorContextFromCommandArgs ( commandArgs : unknown [ ] , isListAcion : boolean , editorService : IEditorService , editorGroupsService : IEditorGroupsService , listService : IListService ) : IEditorCommandsContext | undefined {
105
+ function getEditorContextFromCommandArgs ( commandArgs : unknown [ ] , isListAction : boolean , editorService : IEditorService , editorGroupsService : IEditorGroupsService , listService : IListService ) : IEditorCommandsContext | undefined {
106
106
// We only know how to extraxt the command context from URI and IEditorCommandsContext arguments
107
107
const filteredArgs = commandArgs . filter ( arg => isEditorCommandsContext ( arg ) || URI . isUri ( arg ) ) ;
108
108
@@ -125,7 +125,7 @@ function getEditorContextFromCommandArgs(commandArgs: unknown[], isListAcion: bo
125
125
126
126
// If there is no context in the arguments, try to find the context from the focused list
127
127
// if the action was executed from a list
128
- if ( isListAcion ) {
128
+ if ( isListAction ) {
129
129
const list = listService . lastFocusedList as List < unknown > ;
130
130
for ( const focusedElement of list . getFocusedElements ( ) ) {
131
131
if ( isGroupOrEditor ( focusedElement ) ) {
@@ -147,6 +147,15 @@ function getMultiSelectContext(editorContext: IEditorCommandsContext, isListActi
147
147
if ( selection . length > 1 ) {
148
148
return selection . map ( e => groupOrEditorToEditorContext ( e , editorContext . preserveFocus , editorGroupsService ) ) ;
149
149
}
150
+
151
+ if ( selection . length === 0 ) {
152
+ // TODO@benibenj workaround for https://github.com/microsoft/vscode/issues/224050
153
+ // Explainer: the `isListAction` flag can be a false positive in certain cases because
154
+ // it will be `true` if the active element is a `List` even if it is part of the editor
155
+ // area. The workaround here is to fallback to `isListAction: false` if the list is not
156
+ // having any editor or group selected.
157
+ return getMultiSelectContext ( editorContext , false , editorService , editorGroupsService , listService ) ;
158
+ }
150
159
}
151
160
// Check editors selected in the group (tabs)
152
161
else {
0 commit comments