Skip to content

Commit

Permalink
searchInWorkspace: multiselect & delete keybind
Browse files Browse the repository at this point in the history
Closes #11874

Implements multiselect in search-in-workspace.
Implements `delete` keybinding in search-in-workspace to dismiss results
Implements `Ctrl`+`C` keybinding in search-in-workspace to copy results.

Signed-Off-By: FernandoAscencio <fernando.ascencio.cama@ericsson.com>
  • Loading branch information
FernandoAscencio committed Mar 28, 2023
1 parent 9cee5f5 commit 697e006
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
} from '@theia/core/lib/browser';
import { SearchInWorkspaceWidget } from './search-in-workspace-widget';
import { injectable, inject, postConstruct } from '@theia/core/shared/inversify';
import { CommandRegistry, MenuModelRegistry, SelectionService, Command } from '@theia/core';
import { CommandRegistry, MenuModelRegistry, SelectionService, Command, isOSX } from '@theia/core';
import { codicon, Widget } from '@theia/core/lib/browser/widgets';
import { FileNavigatorCommands, NavigatorContextMenu } from '@theia/navigator/lib/browser/navigator-contribution';
import { UriCommandHandler, UriAwareCommandHandler } from '@theia/core/lib/common/uri-command-handler';
Expand Down Expand Up @@ -218,7 +218,9 @@ export class SearchInWorkspaceFrontendContribution extends AbstractViewContribut
execute: () => this.withWidget(undefined, widget => {
const { selection } = this.selectionService;
if (TreeWidgetSelection.is(selection)) {
widget.resultTreeWidget.removeNode(selection[0]);
for (const selected of selection) {
widget.resultTreeWidget.removeNode(selected);
}
}
})
});
Expand Down Expand Up @@ -303,6 +305,16 @@ export class SearchInWorkspaceFrontendContribution extends AbstractViewContribut
keybinding: 'shift+alt+f',
when: 'explorerResourceIsFolder'
});
keybindings.registerKeybinding({
command: SearchInWorkspaceCommands.DISMISS_RESULT.id,
keybinding: isOSX ? 'cmd+backspace' : 'del',
when: 'searchViewletFocus && !inputBoxFocus'
});
keybindings.registerKeybinding({
command: SearchInWorkspaceCommands.COPY_ONE.id,
keybinding: 'ctrlcmd+c',
when: 'searchViewletFocus && !inputBoxFocus'
});
}

override registerMenus(menus: MenuModelRegistry): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export function createSearchTreeWidget(parent: interfaces.Container): SearchInWo
widget: SearchInWorkspaceResultTreeWidget,
props: {
contextMenuPath: SearchInWorkspaceResultTreeWidget.Menus.BASE,
multiSelect: true,
globalSelection: true
}
});
Expand Down

0 comments on commit 697e006

Please sign in to comment.