@@ -16,7 +16,7 @@ import { toErrorMessage } from 'vs/base/common/errorMessage';
1616import strings = require( 'vs/base/common/strings' ) ;
1717import { Mode , IEntryRunContext , IAutoFocus } from 'vs/base/parts/quickopen/common/quickOpen' ;
1818import { QuickOpenEntryGroup , IHighlight , QuickOpenModel , QuickOpenEntry } from 'vs/base/parts/quickopen/browser/quickOpenModel' ;
19- import { SyncActionDescriptor , IMenuService , MenuId } from 'vs/platform/actions/common/actions' ;
19+ import { SyncActionDescriptor , IMenuService , MenuId , MenuItemAction } from 'vs/platform/actions/common/actions' ;
2020import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey' ;
2121import { IWorkbenchActionRegistry , Extensions as ActionExtensions } from 'vs/workbench/common/actionRegistry' ;
2222import { Registry } from 'vs/platform/platform' ;
@@ -277,8 +277,8 @@ export class CommandsHandler extends QuickOpenHandler {
277277
278278 // Other Actions
279279 const menu = this . menuService . createMenu ( MenuId . CommandPalette , this . contextKeyService ) ;
280- const menuActions = menu . getActions ( ) . reduce ( ( r , [ , actions ] ) => [ ...r , ...actions ] , [ ] ) ;
281- const commandEntries = this . commandActionsToEntries ( menuActions , searchValue ) ;
280+ const menuActions = menu . getActions ( ) . reduce ( ( r , [ , actions ] ) => [ ...r , ...actions ] , < MenuItemAction [ ] > [ ] ) ;
281+ const commandEntries = this . menuItemActionsToEntries ( menuActions , searchValue ) ;
282282
283283 // Concat
284284 let entries = [ ...workbenchEntries , ...editorEntries , ...commandEntries ] ;
@@ -355,17 +355,21 @@ export class CommandsHandler extends QuickOpenHandler {
355355 return entries ;
356356 }
357357
358- private commandActionsToEntries ( actions : IAction [ ] , searchValue : string ) : ActionCommandEntry [ ] {
358+ private menuItemActionsToEntries ( actions : MenuItemAction [ ] , searchValue : string ) : ActionCommandEntry [ ] {
359359 const entries : ActionCommandEntry [ ] = [ ] ;
360360
361361 for ( let action of actions ) {
362- const [ keybind ] = this . keybindingService . lookupKeybindings ( action . id ) ;
362+ const label = action . item . category
363+ ? nls . localize ( 'cat.title' , "{0}: {1}" , action . item . category , action . item . title )
364+ : action . item . title ;
365+ const highlights = wordFilter ( searchValue , label ) ;
366+ if ( ! highlights ) {
367+ continue ;
368+ }
369+ const [ keybind ] = this . keybindingService . lookupKeybindings ( action . item . id ) ;
363370 const keyLabel = keybind ? this . keybindingService . getLabelFor ( keybind ) : '' ;
364371 const keyAriaLabel = keybind ? this . keybindingService . getAriaLabelFor ( keybind ) : '' ;
365- const highlights = wordFilter ( searchValue , action . label ) ;
366- if ( highlights ) {
367- entries . push ( this . instantiationService . createInstance ( ActionCommandEntry , keyLabel , keyAriaLabel , action . label , null , highlights , null , action ) ) ;
368- }
372+ entries . push ( this . instantiationService . createInstance ( ActionCommandEntry , keyLabel , keyAriaLabel , label , null , highlights , null , action ) ) ;
369373 }
370374
371375 return entries ;
@@ -398,4 +402,4 @@ export class EditorCommandsHandler extends CommandsHandler {
398402 protected includeWorkbenchCommands ( ) : boolean {
399403 return false ;
400404 }
401- }
405+ }
0 commit comments