-
Notifications
You must be signed in to change notification settings - Fork 30k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose a new local terminal command on remote
- Loading branch information
Showing
5 changed files
with
57 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
import * as nls from 'vs/nls'; | ||
import { Registry } from 'vs/platform/registry/common/platform'; | ||
import { Extensions as ActionExtensions, IWorkbenchActionRegistry } from 'vs/workbench/common/actions'; | ||
import { SyncActionDescriptor } from 'vs/platform/actions/common/actions'; | ||
import { TERMINAL_ACTION_CATEGORY, ITerminalService } from 'vs/workbench/contrib/terminal/common/terminal'; | ||
import { TERMINAL_COMMAND_ID } from 'vs/workbench/contrib/terminal/common/terminalCommands'; | ||
import { Action } from 'vs/base/common/actions'; | ||
import { URI } from 'vs/base/common/uri'; | ||
import { homedir } from 'os'; | ||
|
||
export function registerRemoteContributions() { | ||
const actionRegistry = Registry.as<IWorkbenchActionRegistry>(ActionExtensions.WorkbenchActions); | ||
actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(CreateNewLocalTerminalAction, CreateNewLocalTerminalAction.ID, CreateNewLocalTerminalAction.LABEL), 'Terminal: Create New Integrated Terminal (Local)', TERMINAL_ACTION_CATEGORY); | ||
} | ||
|
||
export class CreateNewLocalTerminalAction extends Action { | ||
public static readonly ID = TERMINAL_COMMAND_ID.NEW_LOCAL; | ||
public static readonly LABEL = nls.localize('workbench.action.terminal.newLocal', "Create New Integrated Terminal (Local)"); | ||
|
||
constructor( | ||
id: string, label: string, | ||
@ITerminalService private readonly terminalService: ITerminalService | ||
) { | ||
super(id, label); | ||
} | ||
|
||
public run(event?: any): Promise<any> { | ||
const instance = this.terminalService.createTerminal({ cwd: URI.file(homedir()) }); | ||
if (!instance) { | ||
return Promise.resolve(undefined); | ||
} | ||
this.terminalService.setActiveInstance(instance); | ||
return this.terminalService.showPanel(true); | ||
} | ||
} |
6520c22
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When might this end up in a release?
6520c22
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Soon, see #75985 for schedule
6520c22
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Tyriar !