Tab Close and Tab Only

This commit is contained in:
rebornix 2016-06-28 14:45:47 +08:00
parent 061f86ea61
commit 17edb76444
4 changed files with 34 additions and 2 deletions

View File

@ -388,6 +388,8 @@ Status | Command | Description
---|--------|------------------------------
:warning: | :1234: :tabe[dit] | Open a new tab page with an empty window, after the current tab page
:warning: | :1234: :tabnew | Open a new tab page with an empty window, after the current tab page
:warning: | :tabc[lose][!] :1234: | Close current tab page.
:warning: | :tabo[nly][!] | Close all other tab pages.
:white_check_mark: | :tabn[ext] :1234: | Go to tab page {count}. The first tab page has number one.
:white_check_mark: | :tabp[revious] :1234: | Go to the previous tab page. Wraps around from the first one to the last one.
:white_check_mark: | :tabfir[st] | Go to the first tab page.

View File

@ -8,7 +8,9 @@ export enum Tab {
Previous,
First,
Last,
New
New,
Close,
Only
}
export interface ITabCommandArguments extends node.ICommandArgs {
@ -61,6 +63,12 @@ export class TabCommand extends node.CommandBase {
case Tab.New:
this.executeCommandWithCount(this._arguments.count, "workbench.action.files.newUntitledFile");
break;
case Tab.Close:
this.executeCommandWithCount(this._arguments.count, "workbench.action.closeActiveEditor");
break;
case Tab.Only:
this.executeCommandWithCount(this._arguments.count, "workbench.action.closeOtherEditors");
break;
default:
break;

View File

@ -14,13 +14,23 @@ export const commandParsers = {
tabn: tabCmd.parseTabNCommandArgs,
tabnext: tabCmd.parseTabNCommandArgs,
tabp: tabCmd.parseTabPCommandArgs,
tabprevious: tabCmd.parseTabPCommandArgs,
tabfirst: tabCmd.parseTabFirstCommandArgs,
tabfir: tabCmd.parseTabFirstCommandArgs,
tablast: tabCmd.parseTabLastCommandArgs,
tabl: tabCmd.parseTabLastCommandArgs,
tabe: tabCmd.parseTabNewCommandArgs,
tabedit: tabCmd.parseTabNewCommandArgs,
tabnew: tabCmd.parseTabNewCommandArgs
tabnew: tabCmd.parseTabNewCommandArgs,
tabclose: tabCmd.parseTabCloseCommandArgs,
tabc: tabCmd.parseTabCloseCommandArgs,
tabo: tabCmd.parseTabOnlyCommandArgs,
tabonly: tabCmd.parseTabOnlyCommandArgs
};

View File

@ -63,4 +63,16 @@ export function parseTabNewCommandArgs(args: string) : node.TabCommand {
return new node.TabCommand({
tab: node.Tab.New
});
}
export function parseTabCloseCommandArgs(args: string) : node.TabCommand {
return new node.TabCommand({
tab: node.Tab.Close
});
}
export function parseTabOnlyCommandArgs(args: string) : node.TabCommand {
return new node.TabCommand({
tab: node.Tab.Only
});
}