Unreviewed changes
2 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:
```
The name of the file: extension/src/language/form.ts
Insertions: 3, Deletions: 3.
@@ -786,14 +786,14 @@
* Helper to prompt for a single field based on its type.
*/
private async promptForField(field: FormField, prevAnswer: any | undefined): Promise<any | undefined> {
- const type = field.type;
+ const fieldType = field.type;
- switch (type.kind) {
+ switch (fieldType.kind) {
case 'file': {
let actionTarget: 'open' | 'save' | undefined;
- if (type.existence !== undefined) {
- const allowsNew = (type.existence & FileExistence.New) !== 0;
- const allowsExisting = (type.existence & FileExistence.Existing) !== 0;
+ if (fieldType.existence !== undefined) {
+ const allowsNew = (fieldType.existence & FileExistence.New) !== 0;
+ const allowsExisting = (fieldType.existence & FileExistence.Existing) !== 0;
if (allowsNew && !allowsExisting) {
actionTarget = 'save';
} else if (allowsExisting && !allowsNew) {
@@ -859,9 +859,9 @@
let canSelectFiles = true;
let canSelectFolders = true;
- if (type.type !== undefined) {
- canSelectFiles = (type.type & FileType.Regular) !== 0;
- canSelectFolders = (type.type & FileType.Directory) !== 0;
+ if (fieldType.type !== undefined) {
+ canSelectFiles = (fieldType.type & FileType.Regular) !== 0;
+ canSelectFolders = (fieldType.type & FileType.Directory) !== 0;
// Safe fallback: if the constraint evaluates to allowing neither
// (which is likely a bug/misconfiguration in the language server),
@@ -902,7 +902,7 @@
} as vscode.InputBoxOptions);
case 'enum': {
- const pickItems = type.entries.map((entry, _) => {
+ const pickItems = fieldType.entries.map((entry, _) => {
return {
// Use description if it exists, otherwise use value
label: entry.description || entry.value,
@@ -921,7 +921,7 @@
}
case 'lazyEnum': {
- return await this.pickLazyEnum(field.description, type.source, type.config);
+ return await this.pickLazyEnum(field.description, fieldType.source, fieldType.config);
}
case 'bool': {
@@ -960,7 +960,7 @@
case 'list': {
// Basic support for lists of primitive strings/numbers via comma-separated input
- if (type.elementType.kind === 'string' || type.elementType.kind === 'number') {
+ if (fieldType.elementType.kind === 'string' || fieldType.elementType.kind === 'number') {
const rawList = await vscode.window.showInputBox({
prompt: `${field.description} (comma separated)`,
ignoreFocusOut: true
@@ -977,14 +977,14 @@
const parts = rawList.split(',').map((s) => s.trim());
- if (type.elementType.kind === 'number') {
+ if (fieldType.elementType.kind === 'number') {
return parts.map(Number).filter((n) => !isNaN(n));
}
return parts;
}
vscode.window.showErrorMessage(
- `List input for ${type.elementType.kind} is not supported in this version.`
+ `List input for ${fieldType.elementType.kind} is not supported in this version.`
);
return undefined;
}
```
Change information
Commit message:
extension/src/language: utilize file type filter in file field
For golang/go#76331
Change-Id: I17caa398f14769380028fce8d61dc98583dc25f4
Files:
- M extension/src/language/form.ts
Change size: S
Delta: 1 file changed, 18 insertions(+), 2 deletions(-)
Branch: refs/heads/master