@theia/external-terminal 1.53.0-next.5 → 1.53.0-next.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,46 +1,46 @@
1
- <div align='center'>
2
-
3
- <br />
4
-
5
- <img src='https://raw.githubusercontent.com/eclipse-theia/theia/master/logo/theia.svg?sanitize=true' alt='theia-ext-logo' width='100px' />
6
-
7
- <h2>ECLIPSE THEIA - EXTERNAL-TERMINAL EXTENSION</h2>
8
-
9
- <hr />
10
-
11
- </div>
12
-
13
- ## Description
14
-
15
- The `@theia/external-terminal` extension contributes the ability to spawn external terminals for `electron` applications.
16
- The extension includes the necessary logic to spawn the appropriate terminal application for each operating system (Windows, Linux, OSX)
17
- by identifying certain environment variables. The extension also contributes preferences to control this behavior if necessary.
18
-
19
- **Note:** The extension does not support browser applications.
20
-
21
- ## Contributions
22
-
23
- ### Commands
24
-
25
- - `OPEN_NATIVE_CONSOLE`: spawns an external terminal (native console) for different use-cases.
26
-
27
- ### Preferences
28
-
29
- - `terminal.external.windowsExec`: the application executable for Windows.
30
- - `terminal.external.linuxExec`: the application executable for Linux.
31
- - `terminal.external.osxExec`: the application executable for OSX.
32
-
33
- ## Additional Information
34
-
35
- - [Theia - GitHub](https://github.com/eclipse-theia/theia)
36
- - [Theia - Website](https://theia-ide.org/)
37
-
38
- ## License
39
-
40
- - [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/)
41
- - [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp)
42
-
43
- ## Trademark
44
-
45
- "Theia" is a trademark of the Eclipse Foundation
46
- https://www.eclipse.org/theia
1
+ <div align='center'>
2
+
3
+ <br />
4
+
5
+ <img src='https://raw.githubusercontent.com/eclipse-theia/theia/master/logo/theia.svg?sanitize=true' alt='theia-ext-logo' width='100px' />
6
+
7
+ <h2>ECLIPSE THEIA - EXTERNAL-TERMINAL EXTENSION</h2>
8
+
9
+ <hr />
10
+
11
+ </div>
12
+
13
+ ## Description
14
+
15
+ The `@theia/external-terminal` extension contributes the ability to spawn external terminals for `electron` applications.
16
+ The extension includes the necessary logic to spawn the appropriate terminal application for each operating system (Windows, Linux, OSX)
17
+ by identifying certain environment variables. The extension also contributes preferences to control this behavior if necessary.
18
+
19
+ **Note:** The extension does not support browser applications.
20
+
21
+ ## Contributions
22
+
23
+ ### Commands
24
+
25
+ - `OPEN_NATIVE_CONSOLE`: spawns an external terminal (native console) for different use-cases.
26
+
27
+ ### Preferences
28
+
29
+ - `terminal.external.windowsExec`: the application executable for Windows.
30
+ - `terminal.external.linuxExec`: the application executable for Linux.
31
+ - `terminal.external.osxExec`: the application executable for OSX.
32
+
33
+ ## Additional Information
34
+
35
+ - [Theia - GitHub](https://github.com/eclipse-theia/theia)
36
+ - [Theia - Website](https://theia-ide.org/)
37
+
38
+ ## License
39
+
40
+ - [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/)
41
+ - [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp)
42
+
43
+ ## Trademark
44
+
45
+ "Theia" is a trademark of the Eclipse Foundation
46
+ https://www.eclipse.org/theia
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@theia/external-terminal",
3
- "version": "1.53.0-next.5+1e5fb536d",
3
+ "version": "1.53.0-next.55+d1a989a68c",
4
4
  "description": "Theia - External Terminal Extension",
5
5
  "dependencies": {
6
- "@theia/core": "1.53.0-next.5+1e5fb536d",
7
- "@theia/editor": "1.53.0-next.5+1e5fb536d",
8
- "@theia/workspace": "1.53.0-next.5+1e5fb536d",
6
+ "@theia/core": "1.53.0-next.55+d1a989a68c",
7
+ "@theia/editor": "1.53.0-next.55+d1a989a68c",
8
+ "@theia/workspace": "1.53.0-next.55+d1a989a68c",
9
9
  "tslib": "^2.6.2"
10
10
  },
11
11
  "publishConfig": {
@@ -42,10 +42,10 @@
42
42
  "watch": "theiaext watch"
43
43
  },
44
44
  "devDependencies": {
45
- "@theia/ext-scripts": "1.52.0"
45
+ "@theia/ext-scripts": "1.53.0"
46
46
  },
47
47
  "nyc": {
48
48
  "extends": "../../configs/nyc.json"
49
49
  },
50
- "gitHead": "1e5fb536d65550ad8fa0fefcec731645b2afc74a"
50
+ "gitHead": "d1a989a68c1b5ec1f9098e9126653c6346844769"
51
51
  }
@@ -1,55 +1,55 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2021 Ericsson and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- export const ExternalTerminalService = Symbol('ExternalTerminalService');
18
- export const externalTerminalServicePath = '/services/external-terminal';
19
-
20
- /**
21
- * Represents the external terminal configuration options.
22
- */
23
- export interface ExternalTerminalConfiguration {
24
- /**
25
- * The external terminal executable for Windows.
26
- */
27
- 'terminal.external.windowsExec': string;
28
- /**
29
- * The external terminal executable for OSX.
30
- */
31
- 'terminal.external.osxExec': string;
32
- /**
33
- * The external terminal executable for Linux.
34
- */
35
- 'terminal.external.linuxExec': string;
36
- }
37
-
38
- export interface ExternalTerminalService {
39
-
40
- /**
41
- * Open a native terminal in the designated working directory.
42
- *
43
- * @param configuration the configuration for opening external terminals.
44
- * @param cwd the string URI of the current working directory where the terminal should open from.
45
- */
46
- openTerminal(configuration: ExternalTerminalConfiguration, cwd: string): Promise<void>;
47
-
48
- /**
49
- * Get the default executable.
50
- *
51
- * @returns the default terminal executable.
52
- */
53
- getDefaultExec(): Promise<string>;
54
-
55
- }
1
+ // *****************************************************************************
2
+ // Copyright (C) 2021 Ericsson and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ export const ExternalTerminalService = Symbol('ExternalTerminalService');
18
+ export const externalTerminalServicePath = '/services/external-terminal';
19
+
20
+ /**
21
+ * Represents the external terminal configuration options.
22
+ */
23
+ export interface ExternalTerminalConfiguration {
24
+ /**
25
+ * The external terminal executable for Windows.
26
+ */
27
+ 'terminal.external.windowsExec': string;
28
+ /**
29
+ * The external terminal executable for OSX.
30
+ */
31
+ 'terminal.external.osxExec': string;
32
+ /**
33
+ * The external terminal executable for Linux.
34
+ */
35
+ 'terminal.external.linuxExec': string;
36
+ }
37
+
38
+ export interface ExternalTerminalService {
39
+
40
+ /**
41
+ * Open a native terminal in the designated working directory.
42
+ *
43
+ * @param configuration the configuration for opening external terminals.
44
+ * @param cwd the string URI of the current working directory where the terminal should open from.
45
+ */
46
+ openTerminal(configuration: ExternalTerminalConfiguration, cwd: string): Promise<void>;
47
+
48
+ /**
49
+ * Get the default executable.
50
+ *
51
+ * @returns the default terminal executable.
52
+ */
53
+ getDefaultExec(): Promise<string>;
54
+
55
+ }
@@ -1,116 +1,116 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2021 Ericsson and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import { inject, injectable } from '@theia/core/shared/inversify';
18
- import { Command, CommandContribution, CommandRegistry } from '@theia/core/lib/common';
19
- import { EnvVariablesServer } from '@theia/core/lib/common/env-variables';
20
- import { KeybindingContribution, KeybindingRegistry, LabelProvider } from '@theia/core/lib/browser';
21
- import { EditorManager } from '@theia/editor/lib/browser/editor-manager';
22
- import { WorkspaceService } from '@theia/workspace/lib/browser';
23
- import { ExternalTerminalService } from '../common/external-terminal';
24
- import { ExternalTerminalPreferenceService } from './external-terminal-preference';
25
- import { QuickPickService } from '@theia/core/lib/common/quick-pick-service';
26
- import { nls } from '@theia/core/lib/common/nls';
27
-
28
- export namespace ExternalTerminalCommands {
29
- export const OPEN_NATIVE_CONSOLE = Command.toDefaultLocalizedCommand({
30
- id: 'workbench.action.terminal.openNativeConsole',
31
- label: 'Open New External Terminal'
32
- });
33
- }
34
-
35
- @injectable()
36
- export class ExternalTerminalFrontendContribution implements CommandContribution, KeybindingContribution {
37
-
38
- @inject(EditorManager)
39
- protected readonly editorManager: EditorManager;
40
-
41
- @inject(EnvVariablesServer)
42
- protected readonly envVariablesServer: EnvVariablesServer;
43
-
44
- @inject(LabelProvider)
45
- protected readonly labelProvider: LabelProvider;
46
-
47
- @inject(QuickPickService)
48
- protected readonly quickPickService: QuickPickService;
49
-
50
- @inject(ExternalTerminalService)
51
- protected readonly externalTerminalService: ExternalTerminalService;
52
-
53
- @inject(ExternalTerminalPreferenceService)
54
- protected readonly externalTerminalPreferences: ExternalTerminalPreferenceService;
55
-
56
- @inject(WorkspaceService)
57
- protected readonly workspaceService: WorkspaceService;
58
-
59
- registerCommands(commands: CommandRegistry): void {
60
- commands.registerCommand(ExternalTerminalCommands.OPEN_NATIVE_CONSOLE, {
61
- execute: () => this.openExternalTerminal()
62
- });
63
- }
64
-
65
- registerKeybindings(keybindings: KeybindingRegistry): void {
66
- keybindings.registerKeybinding({
67
- command: ExternalTerminalCommands.OPEN_NATIVE_CONSOLE.id,
68
- keybinding: 'ctrlcmd+shift+c',
69
- when: '!terminalFocus'
70
- });
71
- }
72
-
73
- /**
74
- * Open a native console on the host machine.
75
- *
76
- * - If multi-root workspace is open, displays a quick pick to let users choose which workspace to spawn the terminal.
77
- * - If only one workspace is open, the terminal spawns at the root of the current workspace.
78
- * - If no workspace is open and there is an active editor, the terminal spawns at the parent folder of that file.
79
- * - If no workspace is open and there are no active editors, the terminal spawns at user home directory.
80
- */
81
- protected async openExternalTerminal(): Promise<void> {
82
- const configuration = this.externalTerminalPreferences.getExternalTerminalConfiguration();
83
-
84
- if (this.workspaceService.isMultiRootWorkspaceOpened) {
85
- const chosenWorkspaceRoot = await this.selectCwd();
86
- if (chosenWorkspaceRoot) {
87
- await this.externalTerminalService.openTerminal(configuration, chosenWorkspaceRoot);
88
- }
89
- return;
90
- }
91
-
92
- if (this.workspaceService.opened) {
93
- const workspaceRootUri = this.workspaceService.tryGetRoots()[0].resource;
94
- await this.externalTerminalService.openTerminal(configuration, workspaceRootUri.toString());
95
- return;
96
- }
97
-
98
- const fallbackUri = this.editorManager.activeEditor?.editor.uri.parent ?? await this.envVariablesServer.getHomeDirUri();
99
- await this.externalTerminalService.openTerminal(configuration, fallbackUri.toString());
100
- }
101
-
102
- /**
103
- * Display a quick pick for user to choose a target workspace in opened workspaces.
104
- */
105
- protected async selectCwd(): Promise<string | undefined> {
106
- const roots = this.workspaceService.tryGetRoots();
107
- const selectedItem = await this.quickPickService.show(roots.map(
108
- ({ resource }) => ({
109
- label: this.labelProvider.getName(resource),
110
- description: this.labelProvider.getLongName(resource),
111
- value: resource.toString()
112
- })
113
- ), { placeholder: nls.localize('theia/external-terminal/cwd', 'Select current working directory for new external terminal') });
114
- return selectedItem?.value;
115
- }
116
- }
1
+ // *****************************************************************************
2
+ // Copyright (C) 2021 Ericsson and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { inject, injectable } from '@theia/core/shared/inversify';
18
+ import { Command, CommandContribution, CommandRegistry } from '@theia/core/lib/common';
19
+ import { EnvVariablesServer } from '@theia/core/lib/common/env-variables';
20
+ import { KeybindingContribution, KeybindingRegistry, LabelProvider } from '@theia/core/lib/browser';
21
+ import { EditorManager } from '@theia/editor/lib/browser/editor-manager';
22
+ import { WorkspaceService } from '@theia/workspace/lib/browser';
23
+ import { ExternalTerminalService } from '../common/external-terminal';
24
+ import { ExternalTerminalPreferenceService } from './external-terminal-preference';
25
+ import { QuickPickService } from '@theia/core/lib/common/quick-pick-service';
26
+ import { nls } from '@theia/core/lib/common/nls';
27
+
28
+ export namespace ExternalTerminalCommands {
29
+ export const OPEN_NATIVE_CONSOLE = Command.toDefaultLocalizedCommand({
30
+ id: 'workbench.action.terminal.openNativeConsole',
31
+ label: 'Open New External Terminal'
32
+ });
33
+ }
34
+
35
+ @injectable()
36
+ export class ExternalTerminalFrontendContribution implements CommandContribution, KeybindingContribution {
37
+
38
+ @inject(EditorManager)
39
+ protected readonly editorManager: EditorManager;
40
+
41
+ @inject(EnvVariablesServer)
42
+ protected readonly envVariablesServer: EnvVariablesServer;
43
+
44
+ @inject(LabelProvider)
45
+ protected readonly labelProvider: LabelProvider;
46
+
47
+ @inject(QuickPickService)
48
+ protected readonly quickPickService: QuickPickService;
49
+
50
+ @inject(ExternalTerminalService)
51
+ protected readonly externalTerminalService: ExternalTerminalService;
52
+
53
+ @inject(ExternalTerminalPreferenceService)
54
+ protected readonly externalTerminalPreferences: ExternalTerminalPreferenceService;
55
+
56
+ @inject(WorkspaceService)
57
+ protected readonly workspaceService: WorkspaceService;
58
+
59
+ registerCommands(commands: CommandRegistry): void {
60
+ commands.registerCommand(ExternalTerminalCommands.OPEN_NATIVE_CONSOLE, {
61
+ execute: () => this.openExternalTerminal()
62
+ });
63
+ }
64
+
65
+ registerKeybindings(keybindings: KeybindingRegistry): void {
66
+ keybindings.registerKeybinding({
67
+ command: ExternalTerminalCommands.OPEN_NATIVE_CONSOLE.id,
68
+ keybinding: 'ctrlcmd+shift+c',
69
+ when: '!terminalFocus'
70
+ });
71
+ }
72
+
73
+ /**
74
+ * Open a native console on the host machine.
75
+ *
76
+ * - If multi-root workspace is open, displays a quick pick to let users choose which workspace to spawn the terminal.
77
+ * - If only one workspace is open, the terminal spawns at the root of the current workspace.
78
+ * - If no workspace is open and there is an active editor, the terminal spawns at the parent folder of that file.
79
+ * - If no workspace is open and there are no active editors, the terminal spawns at user home directory.
80
+ */
81
+ protected async openExternalTerminal(): Promise<void> {
82
+ const configuration = this.externalTerminalPreferences.getExternalTerminalConfiguration();
83
+
84
+ if (this.workspaceService.isMultiRootWorkspaceOpened) {
85
+ const chosenWorkspaceRoot = await this.selectCwd();
86
+ if (chosenWorkspaceRoot) {
87
+ await this.externalTerminalService.openTerminal(configuration, chosenWorkspaceRoot);
88
+ }
89
+ return;
90
+ }
91
+
92
+ if (this.workspaceService.opened) {
93
+ const workspaceRootUri = this.workspaceService.tryGetRoots()[0].resource;
94
+ await this.externalTerminalService.openTerminal(configuration, workspaceRootUri.toString());
95
+ return;
96
+ }
97
+
98
+ const fallbackUri = this.editorManager.activeEditor?.editor.uri.parent ?? await this.envVariablesServer.getHomeDirUri();
99
+ await this.externalTerminalService.openTerminal(configuration, fallbackUri.toString());
100
+ }
101
+
102
+ /**
103
+ * Display a quick pick for user to choose a target workspace in opened workspaces.
104
+ */
105
+ protected async selectCwd(): Promise<string | undefined> {
106
+ const roots = this.workspaceService.tryGetRoots();
107
+ const selectedItem = await this.quickPickService.show(roots.map(
108
+ ({ resource }) => ({
109
+ label: this.labelProvider.getName(resource),
110
+ description: this.labelProvider.getLongName(resource),
111
+ value: resource.toString()
112
+ })
113
+ ), { placeholder: nls.localize('theia/external-terminal/cwd', 'Select current working directory for new external terminal') });
114
+ return selectedItem?.value;
115
+ }
116
+ }
@@ -1,33 +1,33 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2021 Ericsson and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import { ContainerModule, interfaces } from '@theia/core/shared/inversify';
18
- import { CommandContribution } from '@theia/core/lib/common';
19
- import { KeybindingContribution, WebSocketConnectionProvider } from '@theia/core/lib/browser';
20
- import { bindExternalTerminalPreferences } from './external-terminal-preference';
21
- import { ExternalTerminalFrontendContribution } from './external-terminal-contribution';
22
- import { ExternalTerminalService, externalTerminalServicePath } from '../common/external-terminal';
23
-
24
- export default new ContainerModule((bind: interfaces.Bind) => {
25
- bind(ExternalTerminalFrontendContribution).toSelf().inSingletonScope();
26
- bindExternalTerminalPreferences(bind);
27
- [CommandContribution, KeybindingContribution].forEach(serviceIdentifier =>
28
- bind(serviceIdentifier).toService(ExternalTerminalFrontendContribution)
29
- );
30
- bind(ExternalTerminalService).toDynamicValue(ctx =>
31
- WebSocketConnectionProvider.createProxy<ExternalTerminalService>(ctx.container, externalTerminalServicePath)
32
- ).inSingletonScope();
33
- });
1
+ // *****************************************************************************
2
+ // Copyright (C) 2021 Ericsson and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { ContainerModule, interfaces } from '@theia/core/shared/inversify';
18
+ import { CommandContribution } from '@theia/core/lib/common';
19
+ import { KeybindingContribution, WebSocketConnectionProvider } from '@theia/core/lib/browser';
20
+ import { bindExternalTerminalPreferences } from './external-terminal-preference';
21
+ import { ExternalTerminalFrontendContribution } from './external-terminal-contribution';
22
+ import { ExternalTerminalService, externalTerminalServicePath } from '../common/external-terminal';
23
+
24
+ export default new ContainerModule((bind: interfaces.Bind) => {
25
+ bind(ExternalTerminalFrontendContribution).toSelf().inSingletonScope();
26
+ bindExternalTerminalPreferences(bind);
27
+ [CommandContribution, KeybindingContribution].forEach(serviceIdentifier =>
28
+ bind(serviceIdentifier).toService(ExternalTerminalFrontendContribution)
29
+ );
30
+ bind(ExternalTerminalService).toDynamicValue(ctx =>
31
+ WebSocketConnectionProvider.createProxy<ExternalTerminalService>(ctx.container, externalTerminalServicePath)
32
+ ).inSingletonScope();
33
+ });