-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[vscode] support
inputs
variable substitution for debug
See https://code.visualstudio.com/docs/editor/variables-reference#_input-variables Signed-off-by: Anton Kosyakov <anton.kosyakov@typefox.io>
- Loading branch information
Showing
8 changed files
with
274 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
131 changes: 131 additions & 0 deletions
131
packages/variable-resolver/src/browser/variable-input-schema.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
/******************************************************************************** | ||
* Copyright (C) 2019 TypeFox and others. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* This Source Code may also be made available under the following Secondary | ||
* Licenses when the conditions for such availability set forth in the Eclipse | ||
* Public License v. 2.0 are satisfied: GNU General Public License, version 2 | ||
* with the GNU Classpath Exception which is available at | ||
* https://www.gnu.org/software/classpath/license.html. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | ||
********************************************************************************/ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
/* | ||
* copied from | ||
* https://github.com/microsoft/vscode/blob/0a34756cae4fc67739e60c708b04637089f8bb0d/src/vs/workbench/services/configurationResolver/common/configurationResolverSchema.ts#L23 | ||
*/ | ||
|
||
const idDescription = "The input's id is used to associate an input with a variable of the form ${input:id}."; | ||
const typeDescription = 'The type of user input prompt to use.'; | ||
const descriptionDescription = 'The description is shown when the user is prompted for input.'; | ||
const defaultDescription = 'The default value for the input.'; | ||
|
||
import { IJSONSchema } from '@theia/core/lib/common/json-schema'; | ||
|
||
export const inputsSchema: IJSONSchema = { | ||
definitions: { | ||
inputs: { | ||
type: 'array', | ||
description: 'User inputs. Used for defining user input prompts, such as free string input or a choice from several options.', | ||
items: { | ||
oneOf: [ | ||
{ | ||
type: 'object', | ||
required: ['id', 'type', 'description'], | ||
additionalProperties: false, | ||
properties: { | ||
id: { | ||
type: 'string', | ||
description: idDescription | ||
}, | ||
type: { | ||
type: 'string', | ||
description: typeDescription, | ||
enum: ['promptString'], | ||
enumDescriptions: [ | ||
"The 'promptString' type opens an input box to ask the user for input." | ||
] | ||
}, | ||
description: { | ||
type: 'string', | ||
description: descriptionDescription | ||
}, | ||
default: { | ||
type: 'string', | ||
description: defaultDescription | ||
}, | ||
} | ||
}, | ||
{ | ||
type: 'object', | ||
required: ['id', 'type', 'description', 'options'], | ||
additionalProperties: false, | ||
properties: { | ||
id: { | ||
type: 'string', | ||
description: idDescription | ||
}, | ||
type: { | ||
type: 'string', | ||
description: typeDescription, | ||
enum: ['pickString'], | ||
enumDescriptions: [ | ||
"The 'pickString' type shows a selection list.", | ||
] | ||
}, | ||
description: { | ||
type: 'string', | ||
description: descriptionDescription | ||
}, | ||
default: { | ||
type: 'string', | ||
description: defaultDescription | ||
}, | ||
options: { | ||
type: 'array', | ||
description: 'An array of strings that defines the options for a quick pick.', | ||
items: { | ||
type: 'string' | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
type: 'object', | ||
required: ['id', 'type', 'command'], | ||
additionalProperties: false, | ||
properties: { | ||
id: { | ||
type: 'string', | ||
description: idDescription | ||
}, | ||
type: { | ||
type: 'string', | ||
description: typeDescription, | ||
enum: ['command'], | ||
enumDescriptions: [ | ||
"The 'command' type executes a command.", | ||
] | ||
}, | ||
command: { | ||
type: 'string', | ||
description: 'The command to execute for this input variable.' | ||
}, | ||
args: { | ||
type: 'object', | ||
description: 'Optional arguments passed to the command.' | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/******************************************************************************** | ||
* Copyright (C) 2019 TypeFox and others. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* This Source Code may also be made available under the following Secondary | ||
* Licenses when the conditions for such availability set forth in the Eclipse | ||
* Public License v. 2.0 are satisfied: GNU General Public License, version 2 | ||
* with the GNU Classpath Exception which is available at | ||
* https://www.gnu.org/software/classpath/license.html. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | ||
********************************************************************************/ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
/* | ||
* copied from | ||
* https://github.com/microsoft/vscode/blob/0a34756cae4fc67739e60c708b04637089f8bb0d/src/vs/workbench/services/configurationResolver/common/configurationResolver.ts#L41-L63 | ||
*/ | ||
export interface VariablePromptStringInput { | ||
id: string; | ||
type: 'promptString'; | ||
description: string; | ||
default?: string; | ||
} | ||
|
||
export interface VariablePickStringInput { | ||
id: string; | ||
type: 'pickString'; | ||
description: string; | ||
options: string[]; | ||
default?: string; | ||
} | ||
|
||
export interface VariableCommandInput { | ||
id: string; | ||
type: 'command'; | ||
command: string; | ||
// tslint:disable-next-line:no-any | ||
args?: any; | ||
} | ||
|
||
export type VariableInput = VariablePromptStringInput | VariablePickStringInput | VariableCommandInput; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters