From eadd849b4ebd769ff7ca33f43f498e51a965fda4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=A4der?= Date: Tue, 17 Jan 2023 10:53:38 +0100 Subject: [PATCH] Addressed first batch of comments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Thomas Mäder --- packages/core/i18n/nls.json | 12 ------------ .../src/browser/terminal-frontend-contribution.ts | 11 +++++------ .../terminal/src/browser/terminal-preferences.ts | 2 +- .../terminal/src/browser/terminal-widget-impl.ts | 4 ++-- 4 files changed, 8 insertions(+), 21 deletions(-) diff --git a/packages/core/i18n/nls.json b/packages/core/i18n/nls.json index 25538d2f3f1e1..30d14423e23e4 100644 --- a/packages/core/i18n/nls.json +++ b/packages/core/i18n/nls.json @@ -445,24 +445,12 @@ "confirmCloseNever": "Never confirm.", "enableCopy": "Enable ctrl-c (cmd-c on macOS) to copy selected text", "enablePaste": "Enable ctrl-v (cmd-v on macOS) to paste from clipboard", - "profileNew": "New Terminal...", - "profileDefault": "Choose Default Profile...", - "selectProfile": "Select a profile for the new terminal", "shellArgsLinux": "The command line arguments to use when on the Linux terminal.", "shellArgsOsx": "The command line arguments to use when on the macOS terminal.", "shellArgsWindows": "The command line arguments to use when on the Windows terminal.", "shellLinux": "The path of the shell that the terminal uses on Linux (default: '{0}'}).", "shellOsx": "The path of the shell that the terminal uses on macOS (default: '{0}'}).", "shellWindows": "The path of the shell that the terminal uses on Windows. (default: '{0}').", - "shell.deprecated": "This is deprecated, the new recommended way to configure your default shell is by creating a terminal profile in 'terminal.integrated.profiles.{0}' and setting its profile name as the default in 'terminal.integrated.defaultProfile.{0}'.", - "defaultProfile": "The default profile used on {0}", - "profiles": "The profiles to present when creating a new terminal. Set the path property manually with optional args. \n\nSet an existing profile to `null` to hide the profile from the list, for example: `{0}: null`.", - "profilePath": "The path of the shell that this profile uses.", - "profileSource": "A profile source that will auto detect the paths to the shell. Note that non-standard executable locations are not supported and must be created manually in a new profile.", - "profileArgs": "The shell arguments that this profile uses.", - "profileEnv": "An object with environment variables that will be added to the terminal profile process. Set to `null` to delete environment variables from the base environment.", - "profileIcon": "A codicon ID to associate with the terminal icon. \nterminal-tmux:\"$(terminal-tmux)\"", - "profileColor": "A terminal theme color ID to associate with the terminal.", "terminate": "Terminate", "terminateActive": "Do you want to terminate the active terminal session?", "terminateActiveMultiple": "Do you want to terminate the {0} active terminal sessions?" diff --git a/packages/terminal/src/browser/terminal-frontend-contribution.ts b/packages/terminal/src/browser/terminal-frontend-contribution.ts index e7572e68fa993..c5cc676748d8e 100644 --- a/packages/terminal/src/browser/terminal-frontend-contribution.ts +++ b/packages/terminal/src/browser/terminal-frontend-contribution.ts @@ -27,8 +27,7 @@ import { Emitter, Event, ViewColumn, - OS, - isWindows + OS } from '@theia/core/lib/common'; import { ApplicationShell, KeybindingContribution, KeyCode, Key, WidgetManager, PreferenceService, @@ -258,7 +257,7 @@ export class TerminalFrontendContribution implements FrontendApplicationContribu this.profileService.onAdded(id => { // extension contributions get read after this point: need to set the default profile if necessary let defaultProfileId; - switch (OS.type()) { + switch (OS.backend.type()) { case OS.Type.Windows: { defaultProfileId = this.terminalPreferences['terminal.integrated.defaultProfile.windows']; break; @@ -277,7 +276,7 @@ export class TerminalFrontendContribution implements FrontendApplicationContribu } async contributeDefaultProfiles(): Promise { - if (isWindows) { + if (OS.backend.isWindows) { this.contributedProfileStore.registerTerminalProfile('cmd', new ShellTerminalProfile(this, { shellPath: await this.resolveShellPath([ '${env:windir}\\Sysnative\\cmd.exe', @@ -300,7 +299,7 @@ export class TerminalFrontendContribution implements FrontendApplicationContribu let legacyShellPath: string | undefined; let legacyShellArgs: string[] | undefined; const removed = new Set(this.userProfileStore.all.map(([id, profile]) => id)); - switch (OS.type()) { + switch (OS.backend.type()) { case OS.Type.Windows: { profiles = this.terminalPreferences['terminal.integrated.profiles.windows']; defaultProfile = this.terminalPreferences['terminal.integrated.defaultProfile.windows']; @@ -968,7 +967,7 @@ export class TerminalFrontendContribution implements FrontendApplicationContribu return; } - this.preferenceService.set(`terminal.integrated.defaultProfile.${OS.type().toLowerCase()}`, result[0], PreferenceScope.User); + this.preferenceService.set(`terminal.integrated.defaultProfile.${OS.backend.type().toLowerCase()}`, result[0], PreferenceScope.User); } protected async openActiveWorkspaceTerminal(options?: ApplicationShell.WidgetOptions): Promise { diff --git a/packages/terminal/src/browser/terminal-preferences.ts b/packages/terminal/src/browser/terminal-preferences.ts index f4c5c72d9f9e3..674cbf3fb1900 100644 --- a/packages/terminal/src/browser/terminal-preferences.ts +++ b/packages/terminal/src/browser/terminal-preferences.ts @@ -38,7 +38,7 @@ const commonProfileProperties: PreferenceSchemaProperties = { }, icon: { type: 'string', - markdownDescription: nls.localize('theia/terminal/profileIcon', 'A codicon ID to associate with the terminal icon. \nterminal-tmux:"$(terminal-tmux)"') + markdownDescription: nls.localize('theia/terminal/profileIcon', 'A codicon ID to associate with the terminal icon.\nterminal-tmux:"$(terminal-tmux)"') }, color: { type: 'string', diff --git a/packages/terminal/src/browser/terminal-widget-impl.ts b/packages/terminal/src/browser/terminal-widget-impl.ts index b427272679b9f..a37e4fc7db063 100644 --- a/packages/terminal/src/browser/terminal-widget-impl.ts +++ b/packages/terminal/src/browser/terminal-widget-impl.ts @@ -492,8 +492,8 @@ export class TerminalWidgetImpl extends TerminalWidget implements StatefulWidget const { cols, rows } = this.term; const terminalId = await this.shellTerminalServer.create({ - shell: this.options.shellPath || this.shellPreferences.shell[OS.type()], - args: this.options.shellArgs || this.shellPreferences.shellArgs[OS.type()], + shell: this.options.shellPath || this.shellPreferences.shell[OS.backend.type()], + args: this.options.shellArgs || this.shellPreferences.shellArgs[OS.backend.type()], env: this.options.env, strictEnv: this.options.strictEnv, isPseudo: this.options.isPseudoTerminal,