@theia/variable-resolver 1.48.1 → 1.48.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.
- package/README.md +114 -114
- package/lib/browser/common-variable-contribution.d.ts +16 -16
- package/lib/browser/common-variable-contribution.js +161 -161
- package/lib/browser/index.d.ts +3 -3
- package/lib/browser/index.js +21 -21
- package/lib/browser/variable-input-schema.d.ts +2 -2
- package/lib/browser/variable-input-schema.js +130 -130
- package/lib/browser/variable-input.d.ts +20 -20
- package/lib/browser/variable-input.js +2 -2
- package/lib/browser/variable-quick-open-service.d.ts +14 -14
- package/lib/browser/variable-quick-open-service.js +69 -69
- package/lib/browser/variable-resolver-frontend-contribution.d.ts +13 -13
- package/lib/browser/variable-resolver-frontend-contribution.js +53 -53
- package/lib/browser/variable-resolver-frontend-contribution.spec.d.ts +4 -4
- package/lib/browser/variable-resolver-frontend-contribution.spec.js +82 -82
- package/lib/browser/variable-resolver-frontend-module.d.ts +3 -3
- package/lib/browser/variable-resolver-frontend-module.js +37 -37
- package/lib/browser/variable-resolver-service.d.ts +50 -50
- package/lib/browser/variable-resolver-service.js +162 -162
- package/lib/browser/variable-resolver-service.spec.d.ts +1 -1
- package/lib/browser/variable-resolver-service.spec.js +75 -75
- package/lib/browser/variable.d.ts +55 -55
- package/lib/browser/variable.js +73 -73
- package/lib/browser/variable.spec.d.ts +1 -1
- package/lib/browser/variable.spec.js +90 -90
- package/lib/common/variable-types.d.ts +7 -7
- package/lib/common/variable-types.js +17 -17
- package/package.json +4 -4
- package/src/browser/common-variable-contribution.ts +151 -151
- package/src/browser/index.ts +19 -19
- package/src/browser/variable-input-schema.ts +131 -131
- package/src/browser/variable-input.ts +47 -47
- package/src/browser/variable-quick-open-service.ts +62 -62
- package/src/browser/variable-resolver-frontend-contribution.spec.ts +98 -98
- package/src/browser/variable-resolver-frontend-contribution.ts +50 -50
- package/src/browser/variable-resolver-frontend-module.ts +40 -40
- package/src/browser/variable-resolver-service.spec.ts +83 -83
- package/src/browser/variable-resolver-service.ts +185 -185
- package/src/browser/variable.spec.ts +106 -106
- package/src/browser/variable.ts +111 -111
- package/src/common/variable-types.ts +23 -23
|
@@ -1,151 +1,151 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2019 TypeFox 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 { injectable, inject, optional } from '@theia/core/shared/inversify';
|
|
18
|
-
import { VariableContribution, VariableRegistry } from './variable';
|
|
19
|
-
import { ApplicationServer } from '@theia/core/lib/common/application-protocol';
|
|
20
|
-
import { EnvVariablesServer } from '@theia/core/lib/common/env-variables';
|
|
21
|
-
import { CommandService } from '@theia/core/lib/common/command';
|
|
22
|
-
import { OS } from '@theia/core/lib/common/os';
|
|
23
|
-
import { PreferenceService } from '@theia/core/lib/browser/preferences/preference-service';
|
|
24
|
-
import { ResourceContextKey } from '@theia/core/lib/browser/resource-context-key';
|
|
25
|
-
import { VariableInput } from './variable-input';
|
|
26
|
-
import { QuickInputService, QuickPickValue } from '@theia/core/lib/browser';
|
|
27
|
-
import { MaybeArray, RecursivePartial } from '@theia/core/lib/common/types';
|
|
28
|
-
import { cancelled } from '@theia/core/lib/common/cancellation';
|
|
29
|
-
import URI from '@theia/core/lib/common/uri';
|
|
30
|
-
|
|
31
|
-
@injectable()
|
|
32
|
-
export class CommonVariableContribution implements VariableContribution {
|
|
33
|
-
|
|
34
|
-
@inject(EnvVariablesServer)
|
|
35
|
-
protected readonly env: EnvVariablesServer;
|
|
36
|
-
|
|
37
|
-
@inject(CommandService)
|
|
38
|
-
protected readonly commands: CommandService;
|
|
39
|
-
|
|
40
|
-
@inject(PreferenceService)
|
|
41
|
-
protected readonly preferences: PreferenceService;
|
|
42
|
-
|
|
43
|
-
@inject(ResourceContextKey)
|
|
44
|
-
protected readonly resourceContextKey: ResourceContextKey;
|
|
45
|
-
|
|
46
|
-
@inject(QuickInputService) @optional()
|
|
47
|
-
protected readonly quickInputService: QuickInputService;
|
|
48
|
-
|
|
49
|
-
@inject(ApplicationServer)
|
|
50
|
-
protected readonly appServer: ApplicationServer;
|
|
51
|
-
|
|
52
|
-
async registerVariables(variables: VariableRegistry): Promise<void> {
|
|
53
|
-
const execPath = await this.env.getExecPath();
|
|
54
|
-
variables.registerVariable({
|
|
55
|
-
name: 'execPath',
|
|
56
|
-
resolve: () => execPath
|
|
57
|
-
});
|
|
58
|
-
variables.registerVariable({
|
|
59
|
-
name: 'pathSeparator',
|
|
60
|
-
resolve: () => OS.backend.isWindows ? '\\' : '/'
|
|
61
|
-
});
|
|
62
|
-
variables.registerVariable({
|
|
63
|
-
name: 'env',
|
|
64
|
-
resolve: async (_, envVariableName) => {
|
|
65
|
-
const envVariable = envVariableName && await this.env.getValue(envVariableName);
|
|
66
|
-
const envValue = envVariable && envVariable.value;
|
|
67
|
-
return envValue || '';
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
variables.registerVariable({
|
|
71
|
-
name: 'config',
|
|
72
|
-
resolve: (resourceUri = new URI(this.resourceContextKey.get()), preferenceName) => {
|
|
73
|
-
if (!preferenceName) {
|
|
74
|
-
return undefined;
|
|
75
|
-
}
|
|
76
|
-
return this.preferences.get(preferenceName, undefined, resourceUri && resourceUri.toString());
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
variables.registerVariable({
|
|
80
|
-
name: 'command',
|
|
81
|
-
resolve: async (contextUri, commandId, configurationSection, commandIdVariables, configuration) => {
|
|
82
|
-
if (commandId) {
|
|
83
|
-
if (commandIdVariables?.[commandId]) {
|
|
84
|
-
commandId = commandIdVariables[commandId];
|
|
85
|
-
}
|
|
86
|
-
const result = await this.commands.executeCommand(commandId, configuration);
|
|
87
|
-
// eslint-disable-next-line no-null/no-null
|
|
88
|
-
if (result === null) {
|
|
89
|
-
throw cancelled();
|
|
90
|
-
}
|
|
91
|
-
return result;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
variables.registerVariable({
|
|
96
|
-
name: 'input',
|
|
97
|
-
resolve: async (resourceUri = new URI(this.resourceContextKey.get()), variable, section) => {
|
|
98
|
-
if (!variable || !section) {
|
|
99
|
-
return undefined;
|
|
100
|
-
}
|
|
101
|
-
const configuration = this.preferences.get<RecursivePartial<{ inputs: MaybeArray<VariableInput> }>>(section, undefined, resourceUri && resourceUri.toString());
|
|
102
|
-
const inputs = !!configuration && 'inputs' in configuration ? configuration.inputs : undefined;
|
|
103
|
-
const input = Array.isArray(inputs) && inputs.find(item => !!item && item.id === variable);
|
|
104
|
-
if (!input) {
|
|
105
|
-
return undefined;
|
|
106
|
-
}
|
|
107
|
-
if (input.type === 'promptString') {
|
|
108
|
-
if (typeof input.description !== 'string') {
|
|
109
|
-
return undefined;
|
|
110
|
-
}
|
|
111
|
-
return this.quickInputService?.input({
|
|
112
|
-
prompt: input.description,
|
|
113
|
-
value: input.default
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
if (input.type === 'pickString') {
|
|
117
|
-
if (typeof input.description !== 'string' || !Array.isArray(input.options)) {
|
|
118
|
-
return undefined;
|
|
119
|
-
}
|
|
120
|
-
const elements: Array<QuickPickValue<string>> = [];
|
|
121
|
-
for (const option of input.options) {
|
|
122
|
-
if (typeof option !== 'string') {
|
|
123
|
-
return undefined;
|
|
124
|
-
}
|
|
125
|
-
if (option === input.default) {
|
|
126
|
-
elements.unshift({
|
|
127
|
-
description: 'Default',
|
|
128
|
-
label: option,
|
|
129
|
-
value: option
|
|
130
|
-
});
|
|
131
|
-
} else {
|
|
132
|
-
elements.push({
|
|
133
|
-
label: option,
|
|
134
|
-
value: option
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
const selectedPick = await this.quickInputService?.showQuickPick(elements, { placeholder: input.description });
|
|
139
|
-
return selectedPick?.value;
|
|
140
|
-
}
|
|
141
|
-
if (input.type === 'command') {
|
|
142
|
-
if (typeof input.command !== 'string') {
|
|
143
|
-
return undefined;
|
|
144
|
-
}
|
|
145
|
-
return this.commands.executeCommand(input.command, input.args);
|
|
146
|
-
}
|
|
147
|
-
return undefined;
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2019 TypeFox 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 { injectable, inject, optional } from '@theia/core/shared/inversify';
|
|
18
|
+
import { VariableContribution, VariableRegistry } from './variable';
|
|
19
|
+
import { ApplicationServer } from '@theia/core/lib/common/application-protocol';
|
|
20
|
+
import { EnvVariablesServer } from '@theia/core/lib/common/env-variables';
|
|
21
|
+
import { CommandService } from '@theia/core/lib/common/command';
|
|
22
|
+
import { OS } from '@theia/core/lib/common/os';
|
|
23
|
+
import { PreferenceService } from '@theia/core/lib/browser/preferences/preference-service';
|
|
24
|
+
import { ResourceContextKey } from '@theia/core/lib/browser/resource-context-key';
|
|
25
|
+
import { VariableInput } from './variable-input';
|
|
26
|
+
import { QuickInputService, QuickPickValue } from '@theia/core/lib/browser';
|
|
27
|
+
import { MaybeArray, RecursivePartial } from '@theia/core/lib/common/types';
|
|
28
|
+
import { cancelled } from '@theia/core/lib/common/cancellation';
|
|
29
|
+
import URI from '@theia/core/lib/common/uri';
|
|
30
|
+
|
|
31
|
+
@injectable()
|
|
32
|
+
export class CommonVariableContribution implements VariableContribution {
|
|
33
|
+
|
|
34
|
+
@inject(EnvVariablesServer)
|
|
35
|
+
protected readonly env: EnvVariablesServer;
|
|
36
|
+
|
|
37
|
+
@inject(CommandService)
|
|
38
|
+
protected readonly commands: CommandService;
|
|
39
|
+
|
|
40
|
+
@inject(PreferenceService)
|
|
41
|
+
protected readonly preferences: PreferenceService;
|
|
42
|
+
|
|
43
|
+
@inject(ResourceContextKey)
|
|
44
|
+
protected readonly resourceContextKey: ResourceContextKey;
|
|
45
|
+
|
|
46
|
+
@inject(QuickInputService) @optional()
|
|
47
|
+
protected readonly quickInputService: QuickInputService;
|
|
48
|
+
|
|
49
|
+
@inject(ApplicationServer)
|
|
50
|
+
protected readonly appServer: ApplicationServer;
|
|
51
|
+
|
|
52
|
+
async registerVariables(variables: VariableRegistry): Promise<void> {
|
|
53
|
+
const execPath = await this.env.getExecPath();
|
|
54
|
+
variables.registerVariable({
|
|
55
|
+
name: 'execPath',
|
|
56
|
+
resolve: () => execPath
|
|
57
|
+
});
|
|
58
|
+
variables.registerVariable({
|
|
59
|
+
name: 'pathSeparator',
|
|
60
|
+
resolve: () => OS.backend.isWindows ? '\\' : '/'
|
|
61
|
+
});
|
|
62
|
+
variables.registerVariable({
|
|
63
|
+
name: 'env',
|
|
64
|
+
resolve: async (_, envVariableName) => {
|
|
65
|
+
const envVariable = envVariableName && await this.env.getValue(envVariableName);
|
|
66
|
+
const envValue = envVariable && envVariable.value;
|
|
67
|
+
return envValue || '';
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
variables.registerVariable({
|
|
71
|
+
name: 'config',
|
|
72
|
+
resolve: (resourceUri = new URI(this.resourceContextKey.get()), preferenceName) => {
|
|
73
|
+
if (!preferenceName) {
|
|
74
|
+
return undefined;
|
|
75
|
+
}
|
|
76
|
+
return this.preferences.get(preferenceName, undefined, resourceUri && resourceUri.toString());
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
variables.registerVariable({
|
|
80
|
+
name: 'command',
|
|
81
|
+
resolve: async (contextUri, commandId, configurationSection, commandIdVariables, configuration) => {
|
|
82
|
+
if (commandId) {
|
|
83
|
+
if (commandIdVariables?.[commandId]) {
|
|
84
|
+
commandId = commandIdVariables[commandId];
|
|
85
|
+
}
|
|
86
|
+
const result = await this.commands.executeCommand(commandId, configuration);
|
|
87
|
+
// eslint-disable-next-line no-null/no-null
|
|
88
|
+
if (result === null) {
|
|
89
|
+
throw cancelled();
|
|
90
|
+
}
|
|
91
|
+
return result;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
variables.registerVariable({
|
|
96
|
+
name: 'input',
|
|
97
|
+
resolve: async (resourceUri = new URI(this.resourceContextKey.get()), variable, section) => {
|
|
98
|
+
if (!variable || !section) {
|
|
99
|
+
return undefined;
|
|
100
|
+
}
|
|
101
|
+
const configuration = this.preferences.get<RecursivePartial<{ inputs: MaybeArray<VariableInput> }>>(section, undefined, resourceUri && resourceUri.toString());
|
|
102
|
+
const inputs = !!configuration && 'inputs' in configuration ? configuration.inputs : undefined;
|
|
103
|
+
const input = Array.isArray(inputs) && inputs.find(item => !!item && item.id === variable);
|
|
104
|
+
if (!input) {
|
|
105
|
+
return undefined;
|
|
106
|
+
}
|
|
107
|
+
if (input.type === 'promptString') {
|
|
108
|
+
if (typeof input.description !== 'string') {
|
|
109
|
+
return undefined;
|
|
110
|
+
}
|
|
111
|
+
return this.quickInputService?.input({
|
|
112
|
+
prompt: input.description,
|
|
113
|
+
value: input.default
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
if (input.type === 'pickString') {
|
|
117
|
+
if (typeof input.description !== 'string' || !Array.isArray(input.options)) {
|
|
118
|
+
return undefined;
|
|
119
|
+
}
|
|
120
|
+
const elements: Array<QuickPickValue<string>> = [];
|
|
121
|
+
for (const option of input.options) {
|
|
122
|
+
if (typeof option !== 'string') {
|
|
123
|
+
return undefined;
|
|
124
|
+
}
|
|
125
|
+
if (option === input.default) {
|
|
126
|
+
elements.unshift({
|
|
127
|
+
description: 'Default',
|
|
128
|
+
label: option,
|
|
129
|
+
value: option
|
|
130
|
+
});
|
|
131
|
+
} else {
|
|
132
|
+
elements.push({
|
|
133
|
+
label: option,
|
|
134
|
+
value: option
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
const selectedPick = await this.quickInputService?.showQuickPick(elements, { placeholder: input.description });
|
|
139
|
+
return selectedPick?.value;
|
|
140
|
+
}
|
|
141
|
+
if (input.type === 'command') {
|
|
142
|
+
if (typeof input.command !== 'string') {
|
|
143
|
+
return undefined;
|
|
144
|
+
}
|
|
145
|
+
return this.commands.executeCommand(input.command, input.args);
|
|
146
|
+
}
|
|
147
|
+
return undefined;
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
}
|
package/src/browser/index.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2018 Red Hat, Inc. 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 * from './variable';
|
|
18
|
-
export * from './variable-quick-open-service';
|
|
19
|
-
export * from './variable-resolver-service';
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2018 Red Hat, Inc. 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 * from './variable';
|
|
18
|
+
export * from './variable-quick-open-service';
|
|
19
|
+
export * from './variable-resolver-service';
|
|
@@ -1,131 +1,131 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2019 TypeFox 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
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
18
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
19
|
-
*--------------------------------------------------------------------------------------------*/
|
|
20
|
-
/*
|
|
21
|
-
* copied from
|
|
22
|
-
* https://github.com/microsoft/vscode/blob/0a34756cae4fc67739e60c708b04637089f8bb0d/src/vs/workbench/services/configurationResolver/common/configurationResolverSchema.ts#L23
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
const idDescription = "The input's id is used to associate an input with a variable of the form ${input:id}.";
|
|
26
|
-
const typeDescription = 'The type of user input prompt to use.';
|
|
27
|
-
const descriptionDescription = 'The description is shown when the user is prompted for input.';
|
|
28
|
-
const defaultDescription = 'The default value for the input.';
|
|
29
|
-
|
|
30
|
-
import { IJSONSchema } from '@theia/core/lib/common/json-schema';
|
|
31
|
-
|
|
32
|
-
export const inputsSchema: IJSONSchema = {
|
|
33
|
-
definitions: {
|
|
34
|
-
inputs: {
|
|
35
|
-
type: 'array',
|
|
36
|
-
description: 'User inputs. Used for defining user input prompts, such as free string input or a choice from several options.',
|
|
37
|
-
items: {
|
|
38
|
-
oneOf: [
|
|
39
|
-
{
|
|
40
|
-
type: 'object',
|
|
41
|
-
required: ['id', 'type', 'description'],
|
|
42
|
-
additionalProperties: false,
|
|
43
|
-
properties: {
|
|
44
|
-
id: {
|
|
45
|
-
type: 'string',
|
|
46
|
-
description: idDescription
|
|
47
|
-
},
|
|
48
|
-
type: {
|
|
49
|
-
type: 'string',
|
|
50
|
-
description: typeDescription,
|
|
51
|
-
enum: ['promptString'],
|
|
52
|
-
enumDescriptions: [
|
|
53
|
-
"The 'promptString' type opens an input box to ask the user for input."
|
|
54
|
-
]
|
|
55
|
-
},
|
|
56
|
-
description: {
|
|
57
|
-
type: 'string',
|
|
58
|
-
description: descriptionDescription
|
|
59
|
-
},
|
|
60
|
-
default: {
|
|
61
|
-
type: 'string',
|
|
62
|
-
description: defaultDescription
|
|
63
|
-
},
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
type: 'object',
|
|
68
|
-
required: ['id', 'type', 'description', 'options'],
|
|
69
|
-
additionalProperties: false,
|
|
70
|
-
properties: {
|
|
71
|
-
id: {
|
|
72
|
-
type: 'string',
|
|
73
|
-
description: idDescription
|
|
74
|
-
},
|
|
75
|
-
type: {
|
|
76
|
-
type: 'string',
|
|
77
|
-
description: typeDescription,
|
|
78
|
-
enum: ['pickString'],
|
|
79
|
-
enumDescriptions: [
|
|
80
|
-
"The 'pickString' type shows a selection list.",
|
|
81
|
-
]
|
|
82
|
-
},
|
|
83
|
-
description: {
|
|
84
|
-
type: 'string',
|
|
85
|
-
description: descriptionDescription
|
|
86
|
-
},
|
|
87
|
-
default: {
|
|
88
|
-
type: 'string',
|
|
89
|
-
description: defaultDescription
|
|
90
|
-
},
|
|
91
|
-
options: {
|
|
92
|
-
type: 'array',
|
|
93
|
-
description: 'An array of strings that defines the options for a quick pick.',
|
|
94
|
-
items: {
|
|
95
|
-
type: 'string'
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
type: 'object',
|
|
102
|
-
required: ['id', 'type', 'command'],
|
|
103
|
-
additionalProperties: false,
|
|
104
|
-
properties: {
|
|
105
|
-
id: {
|
|
106
|
-
type: 'string',
|
|
107
|
-
description: idDescription
|
|
108
|
-
},
|
|
109
|
-
type: {
|
|
110
|
-
type: 'string',
|
|
111
|
-
description: typeDescription,
|
|
112
|
-
enum: ['command'],
|
|
113
|
-
enumDescriptions: [
|
|
114
|
-
"The 'command' type executes a command.",
|
|
115
|
-
]
|
|
116
|
-
},
|
|
117
|
-
command: {
|
|
118
|
-
type: 'string',
|
|
119
|
-
description: 'The command to execute for this input variable.'
|
|
120
|
-
},
|
|
121
|
-
args: {
|
|
122
|
-
type: 'object',
|
|
123
|
-
description: 'Optional arguments passed to the command.'
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
]
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
};
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2019 TypeFox 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
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
18
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
19
|
+
*--------------------------------------------------------------------------------------------*/
|
|
20
|
+
/*
|
|
21
|
+
* copied from
|
|
22
|
+
* https://github.com/microsoft/vscode/blob/0a34756cae4fc67739e60c708b04637089f8bb0d/src/vs/workbench/services/configurationResolver/common/configurationResolverSchema.ts#L23
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
const idDescription = "The input's id is used to associate an input with a variable of the form ${input:id}.";
|
|
26
|
+
const typeDescription = 'The type of user input prompt to use.';
|
|
27
|
+
const descriptionDescription = 'The description is shown when the user is prompted for input.';
|
|
28
|
+
const defaultDescription = 'The default value for the input.';
|
|
29
|
+
|
|
30
|
+
import { IJSONSchema } from '@theia/core/lib/common/json-schema';
|
|
31
|
+
|
|
32
|
+
export const inputsSchema: IJSONSchema = {
|
|
33
|
+
definitions: {
|
|
34
|
+
inputs: {
|
|
35
|
+
type: 'array',
|
|
36
|
+
description: 'User inputs. Used for defining user input prompts, such as free string input or a choice from several options.',
|
|
37
|
+
items: {
|
|
38
|
+
oneOf: [
|
|
39
|
+
{
|
|
40
|
+
type: 'object',
|
|
41
|
+
required: ['id', 'type', 'description'],
|
|
42
|
+
additionalProperties: false,
|
|
43
|
+
properties: {
|
|
44
|
+
id: {
|
|
45
|
+
type: 'string',
|
|
46
|
+
description: idDescription
|
|
47
|
+
},
|
|
48
|
+
type: {
|
|
49
|
+
type: 'string',
|
|
50
|
+
description: typeDescription,
|
|
51
|
+
enum: ['promptString'],
|
|
52
|
+
enumDescriptions: [
|
|
53
|
+
"The 'promptString' type opens an input box to ask the user for input."
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
description: {
|
|
57
|
+
type: 'string',
|
|
58
|
+
description: descriptionDescription
|
|
59
|
+
},
|
|
60
|
+
default: {
|
|
61
|
+
type: 'string',
|
|
62
|
+
description: defaultDescription
|
|
63
|
+
},
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
type: 'object',
|
|
68
|
+
required: ['id', 'type', 'description', 'options'],
|
|
69
|
+
additionalProperties: false,
|
|
70
|
+
properties: {
|
|
71
|
+
id: {
|
|
72
|
+
type: 'string',
|
|
73
|
+
description: idDescription
|
|
74
|
+
},
|
|
75
|
+
type: {
|
|
76
|
+
type: 'string',
|
|
77
|
+
description: typeDescription,
|
|
78
|
+
enum: ['pickString'],
|
|
79
|
+
enumDescriptions: [
|
|
80
|
+
"The 'pickString' type shows a selection list.",
|
|
81
|
+
]
|
|
82
|
+
},
|
|
83
|
+
description: {
|
|
84
|
+
type: 'string',
|
|
85
|
+
description: descriptionDescription
|
|
86
|
+
},
|
|
87
|
+
default: {
|
|
88
|
+
type: 'string',
|
|
89
|
+
description: defaultDescription
|
|
90
|
+
},
|
|
91
|
+
options: {
|
|
92
|
+
type: 'array',
|
|
93
|
+
description: 'An array of strings that defines the options for a quick pick.',
|
|
94
|
+
items: {
|
|
95
|
+
type: 'string'
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
type: 'object',
|
|
102
|
+
required: ['id', 'type', 'command'],
|
|
103
|
+
additionalProperties: false,
|
|
104
|
+
properties: {
|
|
105
|
+
id: {
|
|
106
|
+
type: 'string',
|
|
107
|
+
description: idDescription
|
|
108
|
+
},
|
|
109
|
+
type: {
|
|
110
|
+
type: 'string',
|
|
111
|
+
description: typeDescription,
|
|
112
|
+
enum: ['command'],
|
|
113
|
+
enumDescriptions: [
|
|
114
|
+
"The 'command' type executes a command.",
|
|
115
|
+
]
|
|
116
|
+
},
|
|
117
|
+
command: {
|
|
118
|
+
type: 'string',
|
|
119
|
+
description: 'The command to execute for this input variable.'
|
|
120
|
+
},
|
|
121
|
+
args: {
|
|
122
|
+
type: 'object',
|
|
123
|
+
description: 'Optional arguments passed to the command.'
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
]
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
};
|