Skip to content

Commit

Permalink
RenameTerminalCommand: intellisense for title
Browse files Browse the repository at this point in the history
microsoft#82105
Feature missing after commit: entry terminal instance probably is not being considered anymore. Requires review.
  • Loading branch information
vintprox authored Oct 18, 2019
1 parent a6fb6f2 commit 811e052
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions src/vs/workbench/contrib/terminal/browser/terminalActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1036,30 +1036,23 @@ export class ManageWorkspaceShellPermissionsTerminalCommand extends Action {
}
}

export class RenameTerminalAction extends Action {

export class RenameTerminalCommand extends Command {
public static readonly ID = TERMINAL_COMMAND_ID.RENAME;
public static readonly LABEL = nls.localize('workbench.action.terminal.rename', "Rename");
public static readonly TITLE_ARG_LABEL = nls.localize('workbench.action.terminal.rename.title', "A title to rename active terminal to");

constructor(
id: string, label: string,
@IQuickOpenService protected quickOpenService: IQuickOpenService,
@IQuickInputService protected quickInputService: IQuickInputService,
@ITerminalService protected terminalService: ITerminalService
) {
super(id, label);
}

public run(entry?: TerminalEntry, args?: { title: string }): Promise<any> {
const terminalInstance = entry ? entry.instance : this.terminalService.getActiveInstance();
public runCommand(accessor: ServicesAccessor, args: { title: string } | undefined): Promise<any> {
const quickInputService = accessor.get(IQuickInputService);
const terminalService = accessor.get(ITerminalService);
const terminalInstance = terminalService.getActiveInstance();
if (!terminalInstance) {
return Promise.resolve(undefined);
}
if (title) {
terminalInstance.setTitle(title, TitleEventSource.Api);
return Promise.resolve(undefined);
}
return this.quickInputService.input({
return quickInputService.input({
value: terminalInstance.title,
prompt: nls.localize('workbench.action.terminal.rename.prompt', "Enter terminal name"),
}).then(name => {
Expand Down

0 comments on commit 811e052

Please sign in to comment.