Skip to content

Commit c3c9f65

Browse files
authored
Input UI normalization (#1496)
1 parent b485dde commit c3c9f65

15 files changed

+69
-78
lines changed

src/commands/addServerNamespaceToWorkspace.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ async function pickNamespaceOnServer(serverName: string): Promise<string> {
7373
}
7474
// Get user's choice of namespace
7575
const namespace = await vscode.window.showQuickPick(allNamespaces, {
76-
placeHolder: `Namespace on server '${serverName}' (${connDisplayString})`,
76+
title: `Pick a namespace on server '${serverName}' (${connDisplayString})`,
7777
ignoreFocusOut: true,
7878
});
7979
return namespace;
@@ -133,7 +133,7 @@ export async function addServerNamespaceToWorkspace(resource?: vscode.Uri): Prom
133133
detail: "Documents opened in this folder will be read-only.",
134134
},
135135
],
136-
{ placeHolder: "Choose the type of access", ignoreFocusOut: true }
136+
{ title: "Pick the type of access", ignoreFocusOut: true }
137137
)
138138
.then((mode) => mode?.value);
139139
}
@@ -194,7 +194,7 @@ async function modifyWsFolderUri(uri: vscode.Uri): Promise<vscode.Uri | undefine
194194
const filterType = await new Promise<string | undefined>((resolve) => {
195195
let result: string;
196196
const quickPick = vscode.window.createQuickPick();
197-
quickPick.placeholder = "Choose what to show in the workspace folder";
197+
quickPick.title = "Pick what to show in the workspace folder";
198198
quickPick.ignoreFocusOut = true;
199199
quickPick.items = [
200200
{
@@ -203,11 +203,11 @@ async function modifyWsFolderUri(uri: vscode.Uri): Promise<vscode.Uri | undefine
203203
},
204204
{
205205
label: "$(file-code) Web Application Files",
206-
detail: "Choose a specific web application, or show all.",
206+
detail: "Pick a specific web application, or show all.",
207207
},
208208
{
209209
label: "$(files) Contents of a Server-side Project",
210-
detail: "Choose an existing project, or create a new one.",
210+
detail: "Pick an existing project, or create a new one.",
211211
},
212212
];
213213
quickPick.activeItems = [project ? quickPick.items[2] : csp ? quickPick.items[1] : quickPick.items[0]];
@@ -263,7 +263,7 @@ async function modifyWsFolderUri(uri: vscode.Uri): Promise<vscode.Uri | undefine
263263
let result: string;
264264
const allItem: vscode.QuickPickItem = { label: "All" };
265265
const quickPick = vscode.window.createQuickPick();
266-
quickPick.placeholder = "Pick a specific web application to show, or show all";
266+
quickPick.title = "Pick a specific web application to show, or show all";
267267
quickPick.ignoreFocusOut = true;
268268
quickPick.items = [
269269
allItem,
@@ -331,7 +331,7 @@ async function modifyWsFolderUri(uri: vscode.Uri): Promise<vscode.Uri | undefine
331331
const otherParams = await vscode.window.showQuickPick(items, {
332332
ignoreFocusOut: true,
333333
canPickMany: true,
334-
placeHolder: "Add optional filters",
334+
title: "Pick optional filters",
335335
});
336336
if (!otherParams) {
337337
return;

src/commands/compile.ts

+9-7
Original file line numberDiff line numberDiff line change
@@ -748,21 +748,23 @@ export async function importXMLFiles(): Promise<any> {
748748
try {
749749
// Use the server connection from a workspace folder
750750
const wsFolder = await getWsFolder(
751-
"Pick a workspace folder. Server-side folders import from the local file system."
751+
"Pick a workspace folder. Server-side folders import from the local file system.",
752+
false,
753+
false,
754+
false,
755+
true
752756
);
753757
if (!wsFolder) {
754758
if (wsFolder === undefined) {
755759
// Strict equality needed because undefined == null
756-
vscode.window.showErrorMessage("'Import XML Files...' command requires an open workspace.", "Dismiss");
760+
vscode.window.showErrorMessage(
761+
"'Import XML Files...' command requires a workspace folder with an active server connection.",
762+
"Dismiss"
763+
);
757764
}
758765
return;
759766
}
760767
const api = new AtelierAPI(wsFolder.uri);
761-
// Make sure the server connection is active
762-
if (!api.active || api.ns == "") {
763-
vscode.window.showErrorMessage("'Import XML Files...' command requires an active server connection.", "Dismiss");
764-
return;
765-
}
766768
// Make sure the server has the xml endpoints
767769
if (api.config.apiVersion < 7) {
768770
vscode.window.showErrorMessage(

src/commands/connectFolderToServerNamespace.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export async function connectFolderToServerNamespace(): Promise<void> {
3737
const pick =
3838
items.length === 1 && !items[0].detail
3939
? items[0]
40-
: await vscode.window.showQuickPick(items, { placeHolder: "Choose folder" });
40+
: await vscode.window.showQuickPick(items, { title: "Pick a folder" });
4141
const folder = allFolders.find((el) => el.name === pick.label);
4242
// Get user's choice of server
4343
const options: vscode.QuickPickOptions = {};
@@ -78,7 +78,7 @@ export async function connectFolderToServerNamespace(): Promise<void> {
7878
}
7979
// Get user's choice of namespace
8080
const namespace = await vscode.window.showQuickPick(allNamespaces, {
81-
placeHolder: `Namespace on server '${serverName}' (${connDisplayString})`,
81+
title: `Pick a namespace on server '${serverName}' (${connDisplayString})`,
8282
});
8383
if (!namespace) {
8484
return;

src/commands/export.ts

+9-11
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ export async function exportAll(): Promise<any> {
165165
.map((el) => el.name);
166166
if (workspaceList.length > 1) {
167167
const selection = await vscode.window.showQuickPick(workspaceList, {
168-
placeHolder: "Select the workspace folder to export files to.",
168+
title: "Pick the workspace folder to export files to.",
169169
});
170170
if (selection === undefined) {
171171
return;
@@ -292,26 +292,24 @@ export async function exportCurrentFile(): Promise<any> {
292292
export async function exportDocumentsToXMLFile(): Promise<void> {
293293
try {
294294
// Use the server connection from a workspace folder
295-
const wsFolder = await getWsFolder("Pick a workspace folder. Server-side folders export to the local file system.");
295+
const wsFolder = await getWsFolder(
296+
"Pick a workspace folder. Server-side folders export to the local file system.",
297+
false,
298+
false,
299+
false,
300+
true
301+
);
296302
if (!wsFolder) {
297303
if (wsFolder === undefined) {
298304
// Strict equality needed because undefined == null
299305
vscode.window.showErrorMessage(
300-
"'Export Documents to XML File...' command requires an open workspace.",
306+
"'Export Documents to XML File...' command requires a workspace folder with an active server connection.",
301307
"Dismiss"
302308
);
303309
}
304310
return;
305311
}
306312
const api = new AtelierAPI(wsFolder.uri);
307-
// Make sure the server connection is active
308-
if (!api.active || api.ns == "") {
309-
vscode.window.showErrorMessage(
310-
"'Export Documents to XML File...' command requires an active server connection.",
311-
"Dismiss"
312-
);
313-
return;
314-
}
315313
// Make sure the server has the xml endpoints
316314
if (api.config.apiVersion < 7) {
317315
vscode.window.showErrorMessage(

src/commands/jumpToTagAndOffset.ts

-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ export async function openErrorLocation(): Promise<void> {
6666
const regex = /^(%?[\p{L}\d]+)?(?:\+(\d+))?\^(%?[\p{L}\d.]+)$/u;
6767
const location = await vscode.window.showInputBox({
6868
title: "Enter the location to open",
69-
ignoreFocusOut: true,
7069
placeHolder: "label+offset^routine",
7170
validateInput: (v) => (regex.test(v.trim()) ? undefined : "Input is not in the format 'label+offset^routine'"),
7271
});

src/commands/project.ts

+3-6
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ export async function pickProject(api: AtelierAPI): Promise<string | undefined>
2525
);
2626
if (projects.length === 0) {
2727
const create = await vscode.window.showQuickPick(["Yes", "No"], {
28-
ignoreFocusOut: true,
29-
placeHolder: `Namespace ${ns} on server '${api.serverId}' contains no projects. Create one?`,
28+
title: `Namespace ${ns} on server '${api.serverId}' contains no projects. Create one?`,
3029
});
3130
if (create == "Yes") {
3231
return createProject(undefined, api);
@@ -38,7 +37,6 @@ export async function pickProject(api: AtelierAPI): Promise<string | undefined>
3837
let resolveOnHide = true;
3938
const quickPick = vscode.window.createQuickPick();
4039
quickPick.title = `Select a project in namespace ${ns} on server '${api.serverId}', or click '+' to add one.`;
41-
quickPick.ignoreFocusOut = true;
4240
quickPick.items = projects;
4341
quickPick.buttons = [{ iconPath: new vscode.ThemeIcon("add"), tooltip: "Create new project" }];
4442

@@ -837,9 +835,8 @@ export async function modifyProject(
837835
};
838836
}),
839837
{
840-
ignoreFocusOut: true,
841838
canPickMany: true,
842-
placeHolder: `Select the items to remove from project '${project}'.`,
839+
title: `Pick the items to remove from project '${project}'.`,
843840
}
844841
);
845842
if (removeQPIs !== undefined) {
@@ -942,7 +939,7 @@ export async function exportProjectContents(node: ProjectNode | undefined): Prom
942939
.map((el) => el.name);
943940
if (workspaceList.length > 1) {
944941
const selection = await vscode.window.showQuickPick(workspaceList, {
945-
placeHolder: "Select the workspace folder to export files to.",
942+
title: "Pick the workspace folder to export files to.",
946943
});
947944
if (selection === undefined) {
948945
return;

src/commands/serverActions.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,7 @@ export async function serverActions(): Promise<void> {
102102
}
103103

104104
const namespace = await vscode.window.showQuickPick(allNamespaces, {
105-
placeHolder: `Choose the namespace to switch to`,
106-
ignoreFocusOut: true,
105+
title: "Pick the namespace to switch to",
107106
});
108107

109108
if (namespace) {
@@ -215,7 +214,7 @@ export async function serverActions(): Promise<void> {
215214
}
216215
return vscode.window
217216
.showQuickPick(actions, {
218-
placeHolder: `Pick action to perform for server ${connInfo}`,
217+
title: `Pick action to perform for server ${connInfo}`,
219218
})
220219
.then(connectionActionsHandler)
221220
.then(async (action) => {
@@ -244,7 +243,7 @@ export async function serverActions(): Promise<void> {
244243
});
245244
if (addins != undefined) {
246245
const addin = await vscode.window.showQuickPick(addins, {
247-
placeHolder: `Pick a Studio Add-In to open for server: ${connInfo}`,
246+
title: `Pick a Studio Add-In to open for server: ${connInfo}`,
248247
});
249248
if (addin) {
250249
const token = await getCSPToken(api, addin.id);

src/commands/studio.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ export class StudioActions {
438438
}
439439
return vscode.window.showQuickPick<StudioAction>(menuItems, {
440440
canPickMany: false,
441-
placeHolder: `Pick a server-side ${noun} to execute${suffix}`,
441+
title: `Pick a server-side ${noun} to execute${suffix}`,
442442
});
443443
})
444444
.then((action) => this.userAction(action));

src/commands/subclass.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export async function subclass(): Promise<void> {
3030
vscode.window
3131
.showQuickPick(
3232
list.map((el) => el.Name),
33-
{ placeHolder: "Pick a subclass" }
33+
{ title: "Pick a subclass" }
3434
)
3535
.then((item) => {
3636
open(item);

src/commands/superclass.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export async function superclass(): Promise<void> {
2323
if (!list.length) {
2424
return;
2525
}
26-
vscode.window.showQuickPick(list, { placeHolder: "Pick a superclass" }).then((item) => {
26+
vscode.window.showQuickPick(list, { title: "Pick a superclass" }).then((item) => {
2727
open(item);
2828
});
2929
})

src/commands/unitTest.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -402,9 +402,8 @@ async function runHandler(
402402
}),
403403
{
404404
matchOnDetail: true,
405-
ignoreFocusOut: true,
406405
title: `Cannot ${action} tests from multiple roots at once`,
407-
placeHolder: `Please select a root to ${action} tests from`,
406+
placeHolder: `Pick a root to ${action} tests from`,
408407
}
409408
);
410409
if (picked) {

src/commands/xmlToUdl.ts

+12-25
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as vscode from "vscode";
22
import path = require("path");
33
import { config, OBJECTSCRIPTXML_FILE_SCHEMA, xmlContentProvider } from "../extension";
44
import { AtelierAPI } from "../api";
5-
import { fileExists, handleError, notIsfs, outputChannel } from "../utils";
5+
import { fileExists, getWsFolder, handleError, notIsfs, outputChannel } from "../utils";
66
import { getFileName } from "./export";
77

88
const exportHeader = /^\s*<Export generator="(Cache|IRIS)" version="\d+"/;
@@ -33,7 +33,6 @@ export async function previewXMLAsUDL(textEditor: vscode.TextEditor, auto = fals
3333
}),
3434
{
3535
canPickMany: true,
36-
ignoreFocusOut: true,
3736
title: "Select the documents to preview",
3837
}
3938
);
@@ -96,29 +95,17 @@ export async function extractXMLFileContents(xmlUri?: vscode.Uri): Promise<void>
9695
if (xmlUri) {
9796
wsFolder = vscode.workspace.getWorkspaceFolder(xmlUri);
9897
} else {
99-
// Can only run this command on non-isfs folders with an active server connection
100-
const options = vscode.workspace.workspaceFolders.filter((f) => notIsfs(f.uri) && new AtelierAPI(f.uri).active);
101-
if (options.length == 0) {
102-
vscode.window.showErrorMessage(
103-
"'Extract Documents from XML File...' command requires a non-isfs workspace folder with an active server connection.",
104-
"Dismiss"
105-
);
98+
// Use the server connection from a workspace folder
99+
wsFolder = await getWsFolder("Pick the workspace folder to run the command in", false, false, true, true);
100+
if (!wsFolder) {
101+
if (wsFolder === undefined) {
102+
// Strict equality needed because undefined == null
103+
vscode.window.showErrorMessage(
104+
"'Extract Documents from XML File...' command requires a non-isfs workspace folder with an active server connection.",
105+
"Dismiss"
106+
);
107+
}
106108
return;
107-
} else if (options.length == 1) {
108-
wsFolder = options[0];
109-
} else {
110-
// Prompt the user to select a workspace folder
111-
wsFolder = (
112-
await vscode.window.showQuickPick(
113-
options.map((f) => {
114-
return { label: f.name, wf: f };
115-
}),
116-
{
117-
ignoreFocusOut: true,
118-
placeHolder: "Pick the workspace folder to run the command in",
119-
}
120-
)
121-
)?.wf;
122109
}
123110
}
124111
if (!wsFolder) return;
@@ -170,7 +157,7 @@ export async function extractXMLFileContents(xmlUri?: vscode.Uri): Promise<void>
170157
{
171158
canPickMany: true,
172159
ignoreFocusOut: true,
173-
title: "Select the documents to extract",
160+
title: "Pick the documents to extract",
174161
placeHolder: "Files are created using your 'objectscript.export' settings",
175162
}
176163
);

src/explorer/explorer.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ export class ObjectScriptExplorerProvider implements vscode.TreeDataProvider<Nod
155155
.then((data) => data.map((ns) => ({ label: ns })))
156156
.then((data) =>
157157
vscode.window.showQuickPick(data, {
158-
placeHolder: `Choose a namespace on ${api.config.host}:${api.config.port} to add to the Explorer`,
158+
title: `Pick a namespace on ${api.config.host}:${api.config.port} to add to the Explorer`,
159159
})
160160
)
161161
.then((ns) => this.showExtra4Workspace(workspaceFolder, ns.label))

src/extension.ts

+11-5
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ export async function checkConnection(
521521
vscode.window
522522
.showInputBox({
523523
password: true,
524-
placeHolder: `Not Authorized. Enter password to connect as user '${username}' to ${connInfo}`,
524+
title: `Not Authorized. Enter password to connect as user '${username}' to ${connInfo}`,
525525
prompt: !api.externalServer ? "If no password is entered the connection will be disabled." : "",
526526
ignoreFocusOut: true,
527527
})
@@ -1052,7 +1052,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<any> {
10521052
}
10531053
return vscode.window
10541054
.showInputBox({
1055-
placeHolder: "Please enter comma delimited arguments list",
1055+
title: "Enter comma delimited arguments list",
10561056
})
10571057
.then((args) => {
10581058
if (args != undefined && args != null) {
@@ -1122,7 +1122,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<any> {
11221122
}
11231123
return vscode.window
11241124
.showQuickPick<vscode.QuickPickItem>(list, {
1125-
placeHolder: `Pick the process to attach to in ${api.ns} on '${api.serverId}'`,
1125+
title: `Pick the process to attach to in ${api.ns} on '${api.serverId}'`,
11261126
matchOnDescription: true,
11271127
})
11281128
.then((value) => {
@@ -1541,11 +1541,17 @@ export async function activate(context: vscode.ExtensionContext): Promise<any> {
15411541
),
15421542
vscode.commands.registerCommand("vscode-objectscript.compileIsfs", (uri) => fileSystemProvider.compile(uri)),
15431543
vscode.commands.registerCommand("vscode-objectscript.openISCDocument", async () => {
1544-
const wsFolder = await getWsFolder("Pick the workspace folder where you want to open a document");
1544+
const wsFolder = await getWsFolder(
1545+
"Pick the workspace folder where you want to open a document",
1546+
false,
1547+
false,
1548+
false,
1549+
true
1550+
);
15451551
if (!wsFolder) {
15461552
if (wsFolder === undefined) {
15471553
// Strict equality needed because undefined == null
1548-
vscode.window.showErrorMessage("No workspace folders are open.", "Dismiss");
1554+
vscode.window.showErrorMessage("No workspace folders with an active server connection are open.", "Dismiss");
15491555
}
15501556
return;
15511557
}

0 commit comments

Comments
 (0)