@theia/external-terminal 1.34.2 → 1.34.3

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.
Files changed (29) hide show
  1. package/LICENSE +641 -641
  2. package/README.md +46 -46
  3. package/lib/common/external-terminal.d.ts +34 -34
  4. package/lib/common/external-terminal.js +20 -20
  5. package/lib/electron-browser/external-terminal-contribution.d.ts +35 -35
  6. package/lib/electron-browser/external-terminal-contribution.js +128 -128
  7. package/lib/electron-browser/external-terminal-frontend-module.d.ts +3 -3
  8. package/lib/electron-browser/external-terminal-frontend-module.js +29 -29
  9. package/lib/electron-browser/external-terminal-preference.d.ts +26 -26
  10. package/lib/electron-browser/external-terminal-preference.js +109 -109
  11. package/lib/electron-node/external-terminal-backend-module.d.ts +4 -4
  12. package/lib/electron-node/external-terminal-backend-module.js +35 -35
  13. package/lib/electron-node/linux-external-terminal-service.d.ts +20 -20
  14. package/lib/electron-node/linux-external-terminal-service.js +102 -102
  15. package/lib/electron-node/mac-external-terminal-service.d.ts +18 -18
  16. package/lib/electron-node/mac-external-terminal-service.js +74 -74
  17. package/lib/electron-node/windows-external-terminal-service.d.ts +25 -25
  18. package/lib/electron-node/windows-external-terminal-service.js +107 -107
  19. package/lib/package.spec.js +25 -25
  20. package/package.json +6 -6
  21. package/src/common/external-terminal.ts +55 -55
  22. package/src/electron-browser/external-terminal-contribution.ts +116 -116
  23. package/src/electron-browser/external-terminal-frontend-module.ts +33 -33
  24. package/src/electron-browser/external-terminal-preference.ts +106 -106
  25. package/src/electron-node/external-terminal-backend-module.ts +40 -40
  26. package/src/electron-node/linux-external-terminal-service.ts +95 -95
  27. package/src/electron-node/mac-external-terminal-service.ts +70 -70
  28. package/src/electron-node/windows-external-terminal-service.ts +110 -110
  29. package/src/package.spec.ts +29 -29
@@ -1,27 +1,27 @@
1
- import { interfaces } from '@theia/core/shared/inversify';
2
- import { PreferenceSchema, PreferenceProxy } from '@theia/core/lib/browser';
3
- import { PreferenceSchemaProvider } from '@theia/core/lib/browser/preferences/preference-contribution';
4
- import { ExternalTerminalService, ExternalTerminalConfiguration } from '../common/external-terminal';
5
- export declare const ExternalTerminalPreferences: unique symbol;
6
- export declare type ExternalTerminalPreferences = PreferenceProxy<ExternalTerminalConfiguration>;
7
- export declare const ExternalTerminalSchemaPromise: unique symbol;
8
- export declare type ExternalTerminalSchemaPromise = Promise<PreferenceSchema>;
9
- export declare function bindExternalTerminalPreferences(bind: interfaces.Bind): void;
10
- export declare class ExternalTerminalPreferenceService {
11
- protected readonly preferences: ExternalTerminalPreferences;
12
- protected readonly preferenceSchemaProvider: PreferenceSchemaProvider;
13
- protected readonly promisedSchema: ExternalTerminalSchemaPromise;
14
- protected init(): void;
15
- /**
16
- * Get the external terminal configurations from preferences.
17
- */
18
- getExternalTerminalConfiguration(): ExternalTerminalConfiguration;
19
- }
20
- /**
21
- * Use the backend {@link ExternalTerminalService} to establish the schema for the `ExternalTerminalPreferences`.
22
- *
23
- * @param externalTerminalService the external terminal backend service.
24
- * @returns a preference schema with the OS default exec set by the backend service.
25
- */
26
- export declare function getExternalTerminalSchema(externalTerminalService: ExternalTerminalService): Promise<PreferenceSchema>;
1
+ import { interfaces } from '@theia/core/shared/inversify';
2
+ import { PreferenceSchema, PreferenceProxy } from '@theia/core/lib/browser';
3
+ import { PreferenceSchemaProvider } from '@theia/core/lib/browser/preferences/preference-contribution';
4
+ import { ExternalTerminalService, ExternalTerminalConfiguration } from '../common/external-terminal';
5
+ export declare const ExternalTerminalPreferences: unique symbol;
6
+ export declare type ExternalTerminalPreferences = PreferenceProxy<ExternalTerminalConfiguration>;
7
+ export declare const ExternalTerminalSchemaPromise: unique symbol;
8
+ export declare type ExternalTerminalSchemaPromise = Promise<PreferenceSchema>;
9
+ export declare function bindExternalTerminalPreferences(bind: interfaces.Bind): void;
10
+ export declare class ExternalTerminalPreferenceService {
11
+ protected readonly preferences: ExternalTerminalPreferences;
12
+ protected readonly preferenceSchemaProvider: PreferenceSchemaProvider;
13
+ protected readonly promisedSchema: ExternalTerminalSchemaPromise;
14
+ protected init(): void;
15
+ /**
16
+ * Get the external terminal configurations from preferences.
17
+ */
18
+ getExternalTerminalConfiguration(): ExternalTerminalConfiguration;
19
+ }
20
+ /**
21
+ * Use the backend {@link ExternalTerminalService} to establish the schema for the `ExternalTerminalPreferences`.
22
+ *
23
+ * @param externalTerminalService the external terminal backend service.
24
+ * @returns a preference schema with the OS default exec set by the backend service.
25
+ */
26
+ export declare function getExternalTerminalSchema(externalTerminalService: ExternalTerminalService): Promise<PreferenceSchema>;
27
27
  //# sourceMappingURL=external-terminal-preference.d.ts.map
@@ -1,110 +1,110 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2021 Ericsson and others.
4
- //
5
- // This program and the accompanying materials are made available under the
6
- // terms of the Eclipse Public License v. 2.0 which is available at
7
- // http://www.eclipse.org/legal/epl-2.0.
8
- //
9
- // This Source Code may also be made available under the following Secondary
10
- // Licenses when the conditions for such availability set forth in the Eclipse
11
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
- // with the GNU Classpath Exception which is available at
13
- // https://www.gnu.org/software/classpath/license.html.
14
- //
15
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
- // *****************************************************************************
17
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
- return c > 3 && r && Object.defineProperty(target, key, r), r;
22
- };
23
- var __metadata = (this && this.__metadata) || function (k, v) {
24
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
- };
26
- Object.defineProperty(exports, "__esModule", { value: true });
27
- exports.getExternalTerminalSchema = exports.ExternalTerminalPreferenceService = exports.bindExternalTerminalPreferences = exports.ExternalTerminalSchemaPromise = exports.ExternalTerminalPreferences = void 0;
28
- const inversify_1 = require("@theia/core/shared/inversify");
29
- const browser_1 = require("@theia/core/lib/browser");
30
- const preference_contribution_1 = require("@theia/core/lib/browser/preferences/preference-contribution");
31
- const os_1 = require("@theia/core/lib/common/os");
32
- const external_terminal_1 = require("../common/external-terminal");
33
- const nls_1 = require("@theia/core/lib/common/nls");
34
- exports.ExternalTerminalPreferences = Symbol('ExternalTerminalPreferences');
35
- exports.ExternalTerminalSchemaPromise = Symbol('ExternalTerminalSchemaPromise');
36
- function bindExternalTerminalPreferences(bind) {
37
- bind(exports.ExternalTerminalSchemaPromise).toDynamicValue(ctx => getExternalTerminalSchema(ctx.container.get(external_terminal_1.ExternalTerminalService))).inSingletonScope();
38
- bind(exports.ExternalTerminalPreferences).toDynamicValue(ctx => (0, browser_1.createPreferenceProxy)(ctx.container.get(browser_1.PreferenceService), ctx.container.get(exports.ExternalTerminalSchemaPromise))).inSingletonScope();
39
- bind(ExternalTerminalPreferenceService).toSelf().inSingletonScope();
40
- }
41
- exports.bindExternalTerminalPreferences = bindExternalTerminalPreferences;
42
- let ExternalTerminalPreferenceService = class ExternalTerminalPreferenceService {
43
- init() {
44
- this.promisedSchema.then(schema => this.preferenceSchemaProvider.setSchema(schema));
45
- }
46
- /**
47
- * Get the external terminal configurations from preferences.
48
- */
49
- getExternalTerminalConfiguration() {
50
- return {
51
- 'terminal.external.linuxExec': this.preferences['terminal.external.linuxExec'],
52
- 'terminal.external.osxExec': this.preferences['terminal.external.osxExec'],
53
- 'terminal.external.windowsExec': this.preferences['terminal.external.windowsExec'],
54
- };
55
- }
56
- };
57
- __decorate([
58
- (0, inversify_1.inject)(exports.ExternalTerminalPreferences),
59
- __metadata("design:type", Object)
60
- ], ExternalTerminalPreferenceService.prototype, "preferences", void 0);
61
- __decorate([
62
- (0, inversify_1.inject)(preference_contribution_1.PreferenceSchemaProvider),
63
- __metadata("design:type", preference_contribution_1.PreferenceSchemaProvider)
64
- ], ExternalTerminalPreferenceService.prototype, "preferenceSchemaProvider", void 0);
65
- __decorate([
66
- (0, inversify_1.inject)(exports.ExternalTerminalSchemaPromise),
67
- __metadata("design:type", Object)
68
- ], ExternalTerminalPreferenceService.prototype, "promisedSchema", void 0);
69
- __decorate([
70
- (0, inversify_1.postConstruct)(),
71
- __metadata("design:type", Function),
72
- __metadata("design:paramtypes", []),
73
- __metadata("design:returntype", void 0)
74
- ], ExternalTerminalPreferenceService.prototype, "init", null);
75
- ExternalTerminalPreferenceService = __decorate([
76
- (0, inversify_1.injectable)()
77
- ], ExternalTerminalPreferenceService);
78
- exports.ExternalTerminalPreferenceService = ExternalTerminalPreferenceService;
79
- /**
80
- * Use the backend {@link ExternalTerminalService} to establish the schema for the `ExternalTerminalPreferences`.
81
- *
82
- * @param externalTerminalService the external terminal backend service.
83
- * @returns a preference schema with the OS default exec set by the backend service.
84
- */
85
- async function getExternalTerminalSchema(externalTerminalService) {
86
- const hostExec = await externalTerminalService.getDefaultExec();
87
- return {
88
- type: 'object',
89
- properties: {
90
- 'terminal.external.windowsExec': {
91
- type: 'string',
92
- typeDetails: { isFilepath: true },
93
- description: nls_1.nls.localizeByDefault('Customizes which terminal to run on Windows.'),
94
- default: `${os_1.isWindows ? hostExec : 'C:\\WINDOWS\\System32\\cmd.exe'}`
95
- },
96
- 'terminal.external.osxExec': {
97
- type: 'string',
98
- description: nls_1.nls.localizeByDefault('Customizes which terminal application to run on macOS.'),
99
- default: `${os_1.isOSX ? hostExec : 'Terminal.app'}`
100
- },
101
- 'terminal.external.linuxExec': {
102
- type: 'string',
103
- description: nls_1.nls.localizeByDefault('Customizes which terminal to run on Linux.'),
104
- default: `${!(os_1.isWindows || os_1.isOSX) ? hostExec : 'xterm'}`
105
- }
106
- }
107
- };
108
- }
109
- exports.getExternalTerminalSchema = getExternalTerminalSchema;
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2021 Ericsson and others.
4
+ //
5
+ // This program and the accompanying materials are made available under the
6
+ // terms of the Eclipse Public License v. 2.0 which is available at
7
+ // http://www.eclipse.org/legal/epl-2.0.
8
+ //
9
+ // This Source Code may also be made available under the following Secondary
10
+ // Licenses when the conditions for such availability set forth in the Eclipse
11
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ // with the GNU Classpath Exception which is available at
13
+ // https://www.gnu.org/software/classpath/license.html.
14
+ //
15
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
22
+ };
23
+ var __metadata = (this && this.__metadata) || function (k, v) {
24
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
+ };
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.getExternalTerminalSchema = exports.ExternalTerminalPreferenceService = exports.bindExternalTerminalPreferences = exports.ExternalTerminalSchemaPromise = exports.ExternalTerminalPreferences = void 0;
28
+ const inversify_1 = require("@theia/core/shared/inversify");
29
+ const browser_1 = require("@theia/core/lib/browser");
30
+ const preference_contribution_1 = require("@theia/core/lib/browser/preferences/preference-contribution");
31
+ const os_1 = require("@theia/core/lib/common/os");
32
+ const external_terminal_1 = require("../common/external-terminal");
33
+ const nls_1 = require("@theia/core/lib/common/nls");
34
+ exports.ExternalTerminalPreferences = Symbol('ExternalTerminalPreferences');
35
+ exports.ExternalTerminalSchemaPromise = Symbol('ExternalTerminalSchemaPromise');
36
+ function bindExternalTerminalPreferences(bind) {
37
+ bind(exports.ExternalTerminalSchemaPromise).toDynamicValue(ctx => getExternalTerminalSchema(ctx.container.get(external_terminal_1.ExternalTerminalService))).inSingletonScope();
38
+ bind(exports.ExternalTerminalPreferences).toDynamicValue(ctx => (0, browser_1.createPreferenceProxy)(ctx.container.get(browser_1.PreferenceService), ctx.container.get(exports.ExternalTerminalSchemaPromise))).inSingletonScope();
39
+ bind(ExternalTerminalPreferenceService).toSelf().inSingletonScope();
40
+ }
41
+ exports.bindExternalTerminalPreferences = bindExternalTerminalPreferences;
42
+ let ExternalTerminalPreferenceService = class ExternalTerminalPreferenceService {
43
+ init() {
44
+ this.promisedSchema.then(schema => this.preferenceSchemaProvider.setSchema(schema));
45
+ }
46
+ /**
47
+ * Get the external terminal configurations from preferences.
48
+ */
49
+ getExternalTerminalConfiguration() {
50
+ return {
51
+ 'terminal.external.linuxExec': this.preferences['terminal.external.linuxExec'],
52
+ 'terminal.external.osxExec': this.preferences['terminal.external.osxExec'],
53
+ 'terminal.external.windowsExec': this.preferences['terminal.external.windowsExec'],
54
+ };
55
+ }
56
+ };
57
+ __decorate([
58
+ (0, inversify_1.inject)(exports.ExternalTerminalPreferences),
59
+ __metadata("design:type", Object)
60
+ ], ExternalTerminalPreferenceService.prototype, "preferences", void 0);
61
+ __decorate([
62
+ (0, inversify_1.inject)(preference_contribution_1.PreferenceSchemaProvider),
63
+ __metadata("design:type", preference_contribution_1.PreferenceSchemaProvider)
64
+ ], ExternalTerminalPreferenceService.prototype, "preferenceSchemaProvider", void 0);
65
+ __decorate([
66
+ (0, inversify_1.inject)(exports.ExternalTerminalSchemaPromise),
67
+ __metadata("design:type", Object)
68
+ ], ExternalTerminalPreferenceService.prototype, "promisedSchema", void 0);
69
+ __decorate([
70
+ (0, inversify_1.postConstruct)(),
71
+ __metadata("design:type", Function),
72
+ __metadata("design:paramtypes", []),
73
+ __metadata("design:returntype", void 0)
74
+ ], ExternalTerminalPreferenceService.prototype, "init", null);
75
+ ExternalTerminalPreferenceService = __decorate([
76
+ (0, inversify_1.injectable)()
77
+ ], ExternalTerminalPreferenceService);
78
+ exports.ExternalTerminalPreferenceService = ExternalTerminalPreferenceService;
79
+ /**
80
+ * Use the backend {@link ExternalTerminalService} to establish the schema for the `ExternalTerminalPreferences`.
81
+ *
82
+ * @param externalTerminalService the external terminal backend service.
83
+ * @returns a preference schema with the OS default exec set by the backend service.
84
+ */
85
+ async function getExternalTerminalSchema(externalTerminalService) {
86
+ const hostExec = await externalTerminalService.getDefaultExec();
87
+ return {
88
+ type: 'object',
89
+ properties: {
90
+ 'terminal.external.windowsExec': {
91
+ type: 'string',
92
+ typeDetails: { isFilepath: true },
93
+ description: nls_1.nls.localizeByDefault('Customizes which terminal to run on Windows.'),
94
+ default: `${os_1.isWindows ? hostExec : 'C:\\WINDOWS\\System32\\cmd.exe'}`
95
+ },
96
+ 'terminal.external.osxExec': {
97
+ type: 'string',
98
+ description: nls_1.nls.localizeByDefault('Customizes which terminal application to run on macOS.'),
99
+ default: `${os_1.isOSX ? hostExec : 'Terminal.app'}`
100
+ },
101
+ 'terminal.external.linuxExec': {
102
+ type: 'string',
103
+ description: nls_1.nls.localizeByDefault('Customizes which terminal to run on Linux.'),
104
+ default: `${!(os_1.isWindows || os_1.isOSX) ? hostExec : 'xterm'}`
105
+ }
106
+ }
107
+ };
108
+ }
109
+ exports.getExternalTerminalSchema = getExternalTerminalSchema;
110
110
  //# sourceMappingURL=external-terminal-preference.js.map
@@ -1,5 +1,5 @@
1
- import { ContainerModule, interfaces } from '@theia/core/shared/inversify';
2
- export declare function bindExternalTerminalService(bind: interfaces.Bind): void;
3
- declare const _default: ContainerModule;
4
- export default _default;
1
+ import { ContainerModule, interfaces } from '@theia/core/shared/inversify';
2
+ export declare function bindExternalTerminalService(bind: interfaces.Bind): void;
3
+ declare const _default: ContainerModule;
4
+ export default _default;
5
5
  //# sourceMappingURL=external-terminal-backend-module.d.ts.map
@@ -1,36 +1,36 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2021 Ericsson and others.
4
- //
5
- // This program and the accompanying materials are made available under the
6
- // terms of the Eclipse Public License v. 2.0 which is available at
7
- // http://www.eclipse.org/legal/epl-2.0.
8
- //
9
- // This Source Code may also be made available under the following Secondary
10
- // Licenses when the conditions for such availability set forth in the Eclipse
11
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
- // with the GNU Classpath Exception which is available at
13
- // https://www.gnu.org/software/classpath/license.html.
14
- //
15
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
- // *****************************************************************************
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.bindExternalTerminalService = void 0;
19
- const inversify_1 = require("@theia/core/shared/inversify");
20
- const common_1 = require("@theia/core/lib/common");
21
- const os_1 = require("@theia/core/lib/common/os");
22
- const external_terminal_1 = require("../common/external-terminal");
23
- const mac_external_terminal_service_1 = require("./mac-external-terminal-service");
24
- const linux_external_terminal_service_1 = require("./linux-external-terminal-service");
25
- const windows_external_terminal_service_1 = require("./windows-external-terminal-service");
26
- function bindExternalTerminalService(bind) {
27
- const serviceProvider = os_1.isWindows ? windows_external_terminal_service_1.WindowsExternalTerminalService : os_1.isOSX ? mac_external_terminal_service_1.MacExternalTerminalService : linux_external_terminal_service_1.LinuxExternalTerminalService;
28
- bind(serviceProvider).toSelf().inSingletonScope();
29
- bind(external_terminal_1.ExternalTerminalService).toService(serviceProvider);
30
- bind(common_1.ConnectionHandler).toDynamicValue(ctx => new common_1.JsonRpcConnectionHandler(external_terminal_1.externalTerminalServicePath, () => ctx.container.get(external_terminal_1.ExternalTerminalService))).inSingletonScope();
31
- }
32
- exports.bindExternalTerminalService = bindExternalTerminalService;
33
- exports.default = new inversify_1.ContainerModule(bind => {
34
- bindExternalTerminalService(bind);
35
- });
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2021 Ericsson and others.
4
+ //
5
+ // This program and the accompanying materials are made available under the
6
+ // terms of the Eclipse Public License v. 2.0 which is available at
7
+ // http://www.eclipse.org/legal/epl-2.0.
8
+ //
9
+ // This Source Code may also be made available under the following Secondary
10
+ // Licenses when the conditions for such availability set forth in the Eclipse
11
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ // with the GNU Classpath Exception which is available at
13
+ // https://www.gnu.org/software/classpath/license.html.
14
+ //
15
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.bindExternalTerminalService = void 0;
19
+ const inversify_1 = require("@theia/core/shared/inversify");
20
+ const common_1 = require("@theia/core/lib/common");
21
+ const os_1 = require("@theia/core/lib/common/os");
22
+ const external_terminal_1 = require("../common/external-terminal");
23
+ const mac_external_terminal_service_1 = require("./mac-external-terminal-service");
24
+ const linux_external_terminal_service_1 = require("./linux-external-terminal-service");
25
+ const windows_external_terminal_service_1 = require("./windows-external-terminal-service");
26
+ function bindExternalTerminalService(bind) {
27
+ const serviceProvider = os_1.isWindows ? windows_external_terminal_service_1.WindowsExternalTerminalService : os_1.isOSX ? mac_external_terminal_service_1.MacExternalTerminalService : linux_external_terminal_service_1.LinuxExternalTerminalService;
28
+ bind(serviceProvider).toSelf().inSingletonScope();
29
+ bind(external_terminal_1.ExternalTerminalService).toService(serviceProvider);
30
+ bind(common_1.ConnectionHandler).toDynamicValue(ctx => new common_1.JsonRpcConnectionHandler(external_terminal_1.externalTerminalServicePath, () => ctx.container.get(external_terminal_1.ExternalTerminalService))).inSingletonScope();
31
+ }
32
+ exports.bindExternalTerminalService = bindExternalTerminalService;
33
+ exports.default = new inversify_1.ContainerModule(bind => {
34
+ bindExternalTerminalService(bind);
35
+ });
36
36
  //# sourceMappingURL=external-terminal-backend-module.js.map
@@ -1,21 +1,21 @@
1
- import { ExternalTerminalService, ExternalTerminalConfiguration } from '../common/external-terminal';
2
- export declare class LinuxExternalTerminalService implements ExternalTerminalService {
3
- protected DEFAULT_TERMINAL_LINUX_READY: Promise<string>;
4
- openTerminal(configuration: ExternalTerminalConfiguration, cwd: string): Promise<void>;
5
- getDefaultExec(): Promise<string>;
6
- /**
7
- * Spawn the external terminal for the given options.
8
- * - The method spawns the terminal application based on the preferences, else uses the default value.
9
- * @param configuration the preference configuration.
10
- * @param cwd the optional current working directory to spawn from.
11
- */
12
- protected spawnTerminal(configuration: ExternalTerminalConfiguration, cwd?: string): Promise<void>;
13
- /**
14
- * Get the default terminal application on Linux.
15
- * - The following method uses environment variables to identify the best default possible for each distro.
16
- *
17
- * @returns the default application on Linux.
18
- */
19
- protected getDefaultTerminalLinux(): Promise<string>;
20
- }
1
+ import { ExternalTerminalService, ExternalTerminalConfiguration } from '../common/external-terminal';
2
+ export declare class LinuxExternalTerminalService implements ExternalTerminalService {
3
+ protected DEFAULT_TERMINAL_LINUX_READY: Promise<string>;
4
+ openTerminal(configuration: ExternalTerminalConfiguration, cwd: string): Promise<void>;
5
+ getDefaultExec(): Promise<string>;
6
+ /**
7
+ * Spawn the external terminal for the given options.
8
+ * - The method spawns the terminal application based on the preferences, else uses the default value.
9
+ * @param configuration the preference configuration.
10
+ * @param cwd the optional current working directory to spawn from.
11
+ */
12
+ protected spawnTerminal(configuration: ExternalTerminalConfiguration, cwd?: string): Promise<void>;
13
+ /**
14
+ * Get the default terminal application on Linux.
15
+ * - The following method uses environment variables to identify the best default possible for each distro.
16
+ *
17
+ * @returns the default application on Linux.
18
+ */
19
+ protected getDefaultTerminalLinux(): Promise<string>;
20
+ }
21
21
  //# sourceMappingURL=linux-external-terminal-service.d.ts.map
@@ -1,103 +1,103 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2021 Ericsson and others.
4
- //
5
- // This program and the accompanying materials are made available under the
6
- // terms of the Eclipse Public License v. 2.0 which is available at
7
- // http://www.eclipse.org/legal/epl-2.0.
8
- //
9
- // This Source Code may also be made available under the following Secondary
10
- // Licenses when the conditions for such availability set forth in the Eclipse
11
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
- // with the GNU Classpath Exception which is available at
13
- // https://www.gnu.org/software/classpath/license.html.
14
- //
15
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
- // *****************************************************************************
17
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
- return c > 3 && r && Object.defineProperty(target, key, r), r;
22
- };
23
- Object.defineProperty(exports, "__esModule", { value: true });
24
- exports.LinuxExternalTerminalService = void 0;
25
- const cp = require("child_process");
26
- const fs = require("@theia/core/shared/fs-extra");
27
- const inversify_1 = require("@theia/core/shared/inversify");
28
- const os_1 = require("@theia/core/lib/common/os");
29
- const file_uri_1 = require("@theia/core/lib/node/file-uri");
30
- /*---------------------------------------------------------------------------------------------
31
- * Copyright (c) Microsoft Corporation. All rights reserved.
32
- * Licensed under the MIT License. See License.txt in the project root for license information.
33
- *--------------------------------------------------------------------------------------------*/
34
- // some code copied and modified from https://github.com/microsoft/vscode/blob/1.52.1/src/vs/workbench/contrib/externalTerminal/node/externalTerminalService.ts
35
- let LinuxExternalTerminalService = class LinuxExternalTerminalService {
36
- async openTerminal(configuration, cwd) {
37
- await this.spawnTerminal(configuration, file_uri_1.FileUri.fsPath(cwd));
38
- }
39
- async getDefaultExec() {
40
- return this.getDefaultTerminalLinux();
41
- }
42
- /**
43
- * Spawn the external terminal for the given options.
44
- * - The method spawns the terminal application based on the preferences, else uses the default value.
45
- * @param configuration the preference configuration.
46
- * @param cwd the optional current working directory to spawn from.
47
- */
48
- async spawnTerminal(configuration, cwd) {
49
- // Use the executable value from the preferences if available, else fallback to the default.
50
- const terminalConfig = configuration['terminal.external.linuxExec'];
51
- const execPromise = terminalConfig ? Promise.resolve(terminalConfig) : this.getDefaultTerminalLinux();
52
- return new Promise((resolve, reject) => {
53
- execPromise.then(exec => {
54
- const env = cwd ? { cwd } : undefined;
55
- const child = cp.spawn(exec, [], env);
56
- child.on('error', reject);
57
- child.on('exit', resolve);
58
- });
59
- });
60
- }
61
- /**
62
- * Get the default terminal application on Linux.
63
- * - The following method uses environment variables to identify the best default possible for each distro.
64
- *
65
- * @returns the default application on Linux.
66
- */
67
- async getDefaultTerminalLinux() {
68
- if (!this.DEFAULT_TERMINAL_LINUX_READY) {
69
- this.DEFAULT_TERMINAL_LINUX_READY = new Promise(async (resolve) => {
70
- if (os_1.OS.type() === os_1.OS.Type.Linux) {
71
- const isDebian = await fs.pathExists('/etc/debian_version');
72
- if (isDebian) {
73
- resolve('x-terminal-emulator');
74
- }
75
- else if (process.env.DESKTOP_SESSION === 'gnome' || process.env.DESKTOP_SESSION === 'gnome-classic') {
76
- resolve('gnome-terminal');
77
- }
78
- else if (process.env.DESKTOP_SESSION === 'kde-plasma') {
79
- resolve('konsole');
80
- }
81
- else if (process.env.COLORTERM) {
82
- resolve(process.env.COLORTERM);
83
- }
84
- else if (process.env.TERM) {
85
- resolve(process.env.TERM);
86
- }
87
- else {
88
- resolve('xterm');
89
- }
90
- }
91
- else {
92
- resolve('xterm');
93
- }
94
- });
95
- }
96
- return this.DEFAULT_TERMINAL_LINUX_READY;
97
- }
98
- };
99
- LinuxExternalTerminalService = __decorate([
100
- (0, inversify_1.injectable)()
101
- ], LinuxExternalTerminalService);
102
- exports.LinuxExternalTerminalService = LinuxExternalTerminalService;
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2021 Ericsson and others.
4
+ //
5
+ // This program and the accompanying materials are made available under the
6
+ // terms of the Eclipse Public License v. 2.0 which is available at
7
+ // http://www.eclipse.org/legal/epl-2.0.
8
+ //
9
+ // This Source Code may also be made available under the following Secondary
10
+ // Licenses when the conditions for such availability set forth in the Eclipse
11
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ // with the GNU Classpath Exception which is available at
13
+ // https://www.gnu.org/software/classpath/license.html.
14
+ //
15
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
22
+ };
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.LinuxExternalTerminalService = void 0;
25
+ const cp = require("child_process");
26
+ const fs = require("@theia/core/shared/fs-extra");
27
+ const inversify_1 = require("@theia/core/shared/inversify");
28
+ const os_1 = require("@theia/core/lib/common/os");
29
+ const file_uri_1 = require("@theia/core/lib/node/file-uri");
30
+ /*---------------------------------------------------------------------------------------------
31
+ * Copyright (c) Microsoft Corporation. All rights reserved.
32
+ * Licensed under the MIT License. See License.txt in the project root for license information.
33
+ *--------------------------------------------------------------------------------------------*/
34
+ // some code copied and modified from https://github.com/microsoft/vscode/blob/1.52.1/src/vs/workbench/contrib/externalTerminal/node/externalTerminalService.ts
35
+ let LinuxExternalTerminalService = class LinuxExternalTerminalService {
36
+ async openTerminal(configuration, cwd) {
37
+ await this.spawnTerminal(configuration, file_uri_1.FileUri.fsPath(cwd));
38
+ }
39
+ async getDefaultExec() {
40
+ return this.getDefaultTerminalLinux();
41
+ }
42
+ /**
43
+ * Spawn the external terminal for the given options.
44
+ * - The method spawns the terminal application based on the preferences, else uses the default value.
45
+ * @param configuration the preference configuration.
46
+ * @param cwd the optional current working directory to spawn from.
47
+ */
48
+ async spawnTerminal(configuration, cwd) {
49
+ // Use the executable value from the preferences if available, else fallback to the default.
50
+ const terminalConfig = configuration['terminal.external.linuxExec'];
51
+ const execPromise = terminalConfig ? Promise.resolve(terminalConfig) : this.getDefaultTerminalLinux();
52
+ return new Promise((resolve, reject) => {
53
+ execPromise.then(exec => {
54
+ const env = cwd ? { cwd } : undefined;
55
+ const child = cp.spawn(exec, [], env);
56
+ child.on('error', reject);
57
+ child.on('exit', resolve);
58
+ });
59
+ });
60
+ }
61
+ /**
62
+ * Get the default terminal application on Linux.
63
+ * - The following method uses environment variables to identify the best default possible for each distro.
64
+ *
65
+ * @returns the default application on Linux.
66
+ */
67
+ async getDefaultTerminalLinux() {
68
+ if (!this.DEFAULT_TERMINAL_LINUX_READY) {
69
+ this.DEFAULT_TERMINAL_LINUX_READY = new Promise(async (resolve) => {
70
+ if (os_1.OS.type() === os_1.OS.Type.Linux) {
71
+ const isDebian = await fs.pathExists('/etc/debian_version');
72
+ if (isDebian) {
73
+ resolve('x-terminal-emulator');
74
+ }
75
+ else if (process.env.DESKTOP_SESSION === 'gnome' || process.env.DESKTOP_SESSION === 'gnome-classic') {
76
+ resolve('gnome-terminal');
77
+ }
78
+ else if (process.env.DESKTOP_SESSION === 'kde-plasma') {
79
+ resolve('konsole');
80
+ }
81
+ else if (process.env.COLORTERM) {
82
+ resolve(process.env.COLORTERM);
83
+ }
84
+ else if (process.env.TERM) {
85
+ resolve(process.env.TERM);
86
+ }
87
+ else {
88
+ resolve('xterm');
89
+ }
90
+ }
91
+ else {
92
+ resolve('xterm');
93
+ }
94
+ });
95
+ }
96
+ return this.DEFAULT_TERMINAL_LINUX_READY;
97
+ }
98
+ };
99
+ LinuxExternalTerminalService = __decorate([
100
+ (0, inversify_1.injectable)()
101
+ ], LinuxExternalTerminalService);
102
+ exports.LinuxExternalTerminalService = LinuxExternalTerminalService;
103
103
  //# sourceMappingURL=linux-external-terminal-service.js.map