@@ -25,6 +25,7 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic
2525import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService' ;
2626import { optional } from 'vs/platform/instantiation/common/instantiation' ;
2727import { IExplorerService } from 'vs/workbench/contrib/files/common/files' ;
28+ import { isWeb } from 'vs/base/common/platform' ;
2829
2930
3031const OPEN_IN_TERMINAL_COMMAND_ID = 'openInTerminal' ;
@@ -82,58 +83,37 @@ CommandsRegistry.registerCommand({
8283 }
8384} ) ;
8485
85- const OPEN_NATIVE_CONSOLE_COMMAND_ID = 'workbench.action.terminal.openNativeConsole' ;
86- KeybindingsRegistry . registerCommandAndKeybindingRule ( {
87- id : OPEN_NATIVE_CONSOLE_COMMAND_ID ,
88- primary : KeyMod . CtrlCmd | KeyMod . Shift | KeyCode . KEY_C ,
89- when : KEYBINDING_CONTEXT_TERMINAL_NOT_FOCUSED ,
90- weight : KeybindingWeight . WorkbenchContrib ,
91- handler : ( accessor ) => {
92- const remoteAgentService = accessor . get ( IRemoteAgentService ) ;
93- const historyService = accessor . get ( IHistoryService ) ;
94-
95- // Open integrated terminal in remote workspaces
96- if ( remoteAgentService . getConnection ( ) ) {
97- const integratedTerminalService = accessor . get ( IIntegratedTerminalService ) ;
98- const root = historyService . getLastActiveWorkspaceRoot ( Schemas . vscodeRemote ) ;
99- let cwd : string | undefined ;
86+ if ( ! isWeb ) {
87+ const OPEN_NATIVE_CONSOLE_COMMAND_ID = 'workbench.action.terminal.openNativeConsole' ;
88+ KeybindingsRegistry . registerCommandAndKeybindingRule ( {
89+ id : OPEN_NATIVE_CONSOLE_COMMAND_ID ,
90+ primary : KeyMod . CtrlCmd | KeyMod . Shift | KeyCode . KEY_C ,
91+ when : KEYBINDING_CONTEXT_TERMINAL_NOT_FOCUSED ,
92+ weight : KeybindingWeight . WorkbenchContrib ,
93+ handler : ( accessor ) => {
94+ const historyService = accessor . get ( IHistoryService ) ;
95+ // Open external terminal in local workspaces
96+ const terminalService = accessor . get ( IExternalTerminalService ) ;
97+ const root = historyService . getLastActiveWorkspaceRoot ( Schemas . file ) ;
10098 if ( root ) {
101- cwd = root . path ;
99+ terminalService . openTerminal ( root . fsPath ) ;
102100 } else {
103- const activeFile = historyService . getLastActiveFile ( Schemas . vscodeRemote ) ;
101+ // Opens current file's folder, if no folder is open in editor
102+ const activeFile = historyService . getLastActiveFile ( Schemas . file ) ;
104103 if ( activeFile ) {
105- cwd = paths . dirname ( activeFile . path ) ;
104+ terminalService . openTerminal ( paths . dirname ( activeFile . fsPath ) ) ;
106105 }
107106 }
108- if ( cwd ) {
109- const instance = integratedTerminalService . createTerminal ( { cwd } ) ;
110- integratedTerminalService . setActiveInstance ( instance ) ;
111- integratedTerminalService . showPanel ( true ) ;
112- }
113- return ;
114107 }
108+ } ) ;
115109
116- // Open external terminal in local workspaces
117- const terminalService = accessor . get ( IExternalTerminalService ) ;
118- const root = historyService . getLastActiveWorkspaceRoot ( Schemas . file ) ;
119- if ( root ) {
120- terminalService . openTerminal ( root . fsPath ) ;
121- } else {
122- // Opens current file's folder, if no folder is open in editor
123- const activeFile = historyService . getLastActiveFile ( Schemas . file ) ;
124- if ( activeFile ) {
125- terminalService . openTerminal ( paths . dirname ( activeFile . fsPath ) ) ;
126- }
110+ MenuRegistry . appendMenuItem ( MenuId . CommandPalette , {
111+ command : {
112+ id : OPEN_NATIVE_CONSOLE_COMMAND_ID ,
113+ title : { value : nls . localize ( 'globalConsoleAction' , "Open New External Terminal" ) , original : 'Open New External Terminal' }
127114 }
128- }
129- } ) ;
130-
131- MenuRegistry . appendMenuItem ( MenuId . CommandPalette , {
132- command : {
133- id : OPEN_NATIVE_CONSOLE_COMMAND_ID ,
134- title : { value : nls . localize ( 'globalConsoleAction' , "Open New External Terminal" ) , original : 'Open New External Terminal' }
135- }
136- } ) ;
115+ } ) ;
116+ }
137117
138118const openConsoleCommand = {
139119 id : OPEN_IN_TERMINAL_COMMAND_ID ,
0 commit comments