Skip to content

Commit

Permalink
Revert "Fix tests"
Browse files Browse the repository at this point in the history
This reverts commit 0554e1a.
  • Loading branch information
dsseng committed Apr 13, 2020
1 parent 4eed751 commit feca093
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 25 deletions.
26 changes: 5 additions & 21 deletions packages/core/src/browser/quick-open/quick-command-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,6 @@ export class QuickCommandService implements QuickOpenModel, QuickOpenHandler {
@inject(CorePreferences)
protected readonly corePreferences: CorePreferences;

protected recent: Command[] = [];
addRecentCommand(command: Command): void {
// If this command is in recent list, remove and append to the start
const index = this.recent.findIndex(c => Command.equals(command, c));
if (index >= 0) {
this.recent.splice(index, 1);
}

const limit: number = this.corePreferences['workbench.commandPalette.history'];

this.recent = [command, ...this.recent].slice(0, limit);
}

protected readonly contexts = new Map<string, string[]>();
pushCommandContext(commandId: string, when: string): Disposable {
const contexts = this.contexts.get(commandId) || [];
Expand Down Expand Up @@ -90,8 +77,7 @@ export class QuickCommandService implements QuickOpenModel, QuickOpenHandler {
{
groupLabel: index === 0 ? 'recently used' : '',
showBorder: false,
},
this
}
)
),
...other.map((command, index) =>
Expand All @@ -102,8 +88,7 @@ export class QuickCommandService implements QuickOpenModel, QuickOpenHandler {
{
groupLabel: recent.length <= 0 ? '' : index === 0 ? 'other commands' : '',
showBorder: recent.length <= 0 ? false : index === 0 ? true : false,
},
this
}
)
),
);
Expand All @@ -129,7 +114,7 @@ export class QuickCommandService implements QuickOpenModel, QuickOpenHandler {
private getCommands(): { recent: Command[], other: Command[] } {

// Get the list of recent commands.
const recentCommands: Command[] = this.recent;
const recentCommands: Command[] = this.commands.recent;

// Get the list of all valid commands.
const allCommands: Command[] = this.getValidCommands(this.commands.commands);
Expand Down Expand Up @@ -225,7 +210,6 @@ export class CommandQuickOpenItem extends QuickOpenGroupItem {
protected readonly commands: CommandRegistry,
protected readonly keybindings: KeybindingRegistry,
protected readonly commandOptions?: QuickOpenGroupItemOptions,
protected readonly quickCommand?: QuickCommandService
) {
super(commandOptions);
this.activeElement = window.document.activeElement as HTMLElement;
Expand Down Expand Up @@ -265,8 +249,8 @@ export class CommandQuickOpenItem extends QuickOpenGroupItem {
this.activeElement.focus({ preventScroll: true });
this.commands.executeCommand(this.command.id);

if (this.quickCommand) {
this.quickCommand.addRecentCommand(this.command);
if (this.command) {
this.commands.addRecentCommand(this.command);
}
}, 50);
return true;
Expand Down
4 changes: 0 additions & 4 deletions packages/core/src/common/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,10 +289,6 @@ export class CommandRegistry implements CommandService {
await this.fireWillExecuteCommand(commandId, args);
const result = await handler.execute(...args);
this.onDidExecuteCommandEmitter.fire({ commandId, args });
const command = this.getCommand(commandId);
if (command) {
this.addRecentCommand(command);
}
return result;
}
const argsMessage = args && args.length > 0 ? ` (args: ${JSON.stringify(args)})` : '';
Expand Down

0 comments on commit feca093

Please sign in to comment.