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

Lines changed: 7 additions & 7 deletions
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

Lines changed: 9 additions & 7 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 9 additions & 11 deletions
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

Lines changed: 0 additions & 1 deletion
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

Lines changed: 3 additions & 6 deletions
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

Lines changed: 3 additions & 4 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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
})

0 commit comments

Comments
 (0)