diff --git a/src/commands/addServerNamespaceToWorkspace.ts b/src/commands/addServerNamespaceToWorkspace.ts index 58d577d5..534d0019 100644 --- a/src/commands/addServerNamespaceToWorkspace.ts +++ b/src/commands/addServerNamespaceToWorkspace.ts @@ -73,7 +73,7 @@ async function pickNamespaceOnServer(serverName: string): Promise { } // Get user's choice of namespace const namespace = await vscode.window.showQuickPick(allNamespaces, { - placeHolder: `Namespace on server '${serverName}' (${connDisplayString})`, + title: `Pick a namespace on server '${serverName}' (${connDisplayString})`, ignoreFocusOut: true, }); return namespace; @@ -133,7 +133,7 @@ export async function addServerNamespaceToWorkspace(resource?: vscode.Uri): Prom detail: "Documents opened in this folder will be read-only.", }, ], - { placeHolder: "Choose the type of access", ignoreFocusOut: true } + { title: "Pick the type of access", ignoreFocusOut: true } ) .then((mode) => mode?.value); } @@ -194,7 +194,7 @@ async function modifyWsFolderUri(uri: vscode.Uri): Promise((resolve) => { let result: string; const quickPick = vscode.window.createQuickPick(); - quickPick.placeholder = "Choose what to show in the workspace folder"; + quickPick.title = "Pick what to show in the workspace folder"; quickPick.ignoreFocusOut = true; quickPick.items = [ { @@ -203,11 +203,11 @@ async function modifyWsFolderUri(uri: vscode.Uri): Promise { try { // Use the server connection from a workspace folder const wsFolder = await getWsFolder( - "Pick a workspace folder. Server-side folders import from the local file system." + "Pick a workspace folder. Server-side folders import from the local file system.", + false, + false, + false, + true ); if (!wsFolder) { if (wsFolder === undefined) { // Strict equality needed because undefined == null - vscode.window.showErrorMessage("'Import XML Files...' command requires an open workspace.", "Dismiss"); + vscode.window.showErrorMessage( + "'Import XML Files...' command requires a workspace folder with an active server connection.", + "Dismiss" + ); } return; } const api = new AtelierAPI(wsFolder.uri); - // Make sure the server connection is active - if (!api.active || api.ns == "") { - vscode.window.showErrorMessage("'Import XML Files...' command requires an active server connection.", "Dismiss"); - return; - } // Make sure the server has the xml endpoints if (api.config.apiVersion < 7) { vscode.window.showErrorMessage( diff --git a/src/commands/connectFolderToServerNamespace.ts b/src/commands/connectFolderToServerNamespace.ts index 5f55339c..eb2550a4 100644 --- a/src/commands/connectFolderToServerNamespace.ts +++ b/src/commands/connectFolderToServerNamespace.ts @@ -37,7 +37,7 @@ export async function connectFolderToServerNamespace(): Promise { const pick = items.length === 1 && !items[0].detail ? items[0] - : await vscode.window.showQuickPick(items, { placeHolder: "Choose folder" }); + : await vscode.window.showQuickPick(items, { title: "Pick a folder" }); const folder = allFolders.find((el) => el.name === pick.label); // Get user's choice of server const options: vscode.QuickPickOptions = {}; @@ -78,7 +78,7 @@ export async function connectFolderToServerNamespace(): Promise { } // Get user's choice of namespace const namespace = await vscode.window.showQuickPick(allNamespaces, { - placeHolder: `Namespace on server '${serverName}' (${connDisplayString})`, + title: `Pick a namespace on server '${serverName}' (${connDisplayString})`, }); if (!namespace) { return; diff --git a/src/commands/export.ts b/src/commands/export.ts index d0fb6b92..a9b38759 100644 --- a/src/commands/export.ts +++ b/src/commands/export.ts @@ -165,7 +165,7 @@ export async function exportAll(): Promise { .map((el) => el.name); if (workspaceList.length > 1) { const selection = await vscode.window.showQuickPick(workspaceList, { - placeHolder: "Select the workspace folder to export files to.", + title: "Pick the workspace folder to export files to.", }); if (selection === undefined) { return; @@ -292,26 +292,24 @@ export async function exportCurrentFile(): Promise { export async function exportDocumentsToXMLFile(): Promise { try { // Use the server connection from a workspace folder - const wsFolder = await getWsFolder("Pick a workspace folder. Server-side folders export to the local file system."); + const wsFolder = await getWsFolder( + "Pick a workspace folder. Server-side folders export to the local file system.", + false, + false, + false, + true + ); if (!wsFolder) { if (wsFolder === undefined) { // Strict equality needed because undefined == null vscode.window.showErrorMessage( - "'Export Documents to XML File...' command requires an open workspace.", + "'Export Documents to XML File...' command requires a workspace folder with an active server connection.", "Dismiss" ); } return; } const api = new AtelierAPI(wsFolder.uri); - // Make sure the server connection is active - if (!api.active || api.ns == "") { - vscode.window.showErrorMessage( - "'Export Documents to XML File...' command requires an active server connection.", - "Dismiss" - ); - return; - } // Make sure the server has the xml endpoints if (api.config.apiVersion < 7) { vscode.window.showErrorMessage( diff --git a/src/commands/jumpToTagAndOffset.ts b/src/commands/jumpToTagAndOffset.ts index 4179de40..a07782ea 100644 --- a/src/commands/jumpToTagAndOffset.ts +++ b/src/commands/jumpToTagAndOffset.ts @@ -66,7 +66,6 @@ export async function openErrorLocation(): Promise { const regex = /^(%?[\p{L}\d]+)?(?:\+(\d+))?\^(%?[\p{L}\d.]+)$/u; const location = await vscode.window.showInputBox({ title: "Enter the location to open", - ignoreFocusOut: true, placeHolder: "label+offset^routine", validateInput: (v) => (regex.test(v.trim()) ? undefined : "Input is not in the format 'label+offset^routine'"), }); diff --git a/src/commands/project.ts b/src/commands/project.ts index 04f23fbb..baaa856c 100644 --- a/src/commands/project.ts +++ b/src/commands/project.ts @@ -25,8 +25,7 @@ export async function pickProject(api: AtelierAPI): Promise ); if (projects.length === 0) { const create = await vscode.window.showQuickPick(["Yes", "No"], { - ignoreFocusOut: true, - placeHolder: `Namespace ${ns} on server '${api.serverId}' contains no projects. Create one?`, + title: `Namespace ${ns} on server '${api.serverId}' contains no projects. Create one?`, }); if (create == "Yes") { return createProject(undefined, api); @@ -38,7 +37,6 @@ export async function pickProject(api: AtelierAPI): Promise let resolveOnHide = true; const quickPick = vscode.window.createQuickPick(); quickPick.title = `Select a project in namespace ${ns} on server '${api.serverId}', or click '+' to add one.`; - quickPick.ignoreFocusOut = true; quickPick.items = projects; quickPick.buttons = [{ iconPath: new vscode.ThemeIcon("add"), tooltip: "Create new project" }]; @@ -837,9 +835,8 @@ export async function modifyProject( }; }), { - ignoreFocusOut: true, canPickMany: true, - placeHolder: `Select the items to remove from project '${project}'.`, + title: `Pick the items to remove from project '${project}'.`, } ); if (removeQPIs !== undefined) { @@ -942,7 +939,7 @@ export async function exportProjectContents(node: ProjectNode | undefined): Prom .map((el) => el.name); if (workspaceList.length > 1) { const selection = await vscode.window.showQuickPick(workspaceList, { - placeHolder: "Select the workspace folder to export files to.", + title: "Pick the workspace folder to export files to.", }); if (selection === undefined) { return; diff --git a/src/commands/serverActions.ts b/src/commands/serverActions.ts index 3fe371df..e4589209 100644 --- a/src/commands/serverActions.ts +++ b/src/commands/serverActions.ts @@ -102,8 +102,7 @@ export async function serverActions(): Promise { } const namespace = await vscode.window.showQuickPick(allNamespaces, { - placeHolder: `Choose the namespace to switch to`, - ignoreFocusOut: true, + title: "Pick the namespace to switch to", }); if (namespace) { @@ -215,7 +214,7 @@ export async function serverActions(): Promise { } return vscode.window .showQuickPick(actions, { - placeHolder: `Pick action to perform for server ${connInfo}`, + title: `Pick action to perform for server ${connInfo}`, }) .then(connectionActionsHandler) .then(async (action) => { @@ -244,7 +243,7 @@ export async function serverActions(): Promise { }); if (addins != undefined) { const addin = await vscode.window.showQuickPick(addins, { - placeHolder: `Pick a Studio Add-In to open for server: ${connInfo}`, + title: `Pick a Studio Add-In to open for server: ${connInfo}`, }); if (addin) { const token = await getCSPToken(api, addin.id); diff --git a/src/commands/studio.ts b/src/commands/studio.ts index 72108ee4..5a08408c 100644 --- a/src/commands/studio.ts +++ b/src/commands/studio.ts @@ -438,7 +438,7 @@ export class StudioActions { } return vscode.window.showQuickPick(menuItems, { canPickMany: false, - placeHolder: `Pick a server-side ${noun} to execute${suffix}`, + title: `Pick a server-side ${noun} to execute${suffix}`, }); }) .then((action) => this.userAction(action)); diff --git a/src/commands/subclass.ts b/src/commands/subclass.ts index 53f2564e..df4c5fc8 100644 --- a/src/commands/subclass.ts +++ b/src/commands/subclass.ts @@ -30,7 +30,7 @@ export async function subclass(): Promise { vscode.window .showQuickPick( list.map((el) => el.Name), - { placeHolder: "Pick a subclass" } + { title: "Pick a subclass" } ) .then((item) => { open(item); diff --git a/src/commands/superclass.ts b/src/commands/superclass.ts index b7b279d4..2b230b03 100644 --- a/src/commands/superclass.ts +++ b/src/commands/superclass.ts @@ -23,7 +23,7 @@ export async function superclass(): Promise { if (!list.length) { return; } - vscode.window.showQuickPick(list, { placeHolder: "Pick a superclass" }).then((item) => { + vscode.window.showQuickPick(list, { title: "Pick a superclass" }).then((item) => { open(item); }); }) diff --git a/src/commands/unitTest.ts b/src/commands/unitTest.ts index e74aa9c2..c5643467 100644 --- a/src/commands/unitTest.ts +++ b/src/commands/unitTest.ts @@ -402,9 +402,8 @@ async function runHandler( }), { matchOnDetail: true, - ignoreFocusOut: true, title: `Cannot ${action} tests from multiple roots at once`, - placeHolder: `Please select a root to ${action} tests from`, + placeHolder: `Pick a root to ${action} tests from`, } ); if (picked) { diff --git a/src/commands/xmlToUdl.ts b/src/commands/xmlToUdl.ts index 058fe086..57fd5f22 100644 --- a/src/commands/xmlToUdl.ts +++ b/src/commands/xmlToUdl.ts @@ -2,7 +2,7 @@ import * as vscode from "vscode"; import path = require("path"); import { config, OBJECTSCRIPTXML_FILE_SCHEMA, xmlContentProvider } from "../extension"; import { AtelierAPI } from "../api"; -import { fileExists, handleError, notIsfs, outputChannel } from "../utils"; +import { fileExists, getWsFolder, handleError, notIsfs, outputChannel } from "../utils"; import { getFileName } from "./export"; const exportHeader = /^\s* if (xmlUri) { wsFolder = vscode.workspace.getWorkspaceFolder(xmlUri); } else { - // Can only run this command on non-isfs folders with an active server connection - const options = vscode.workspace.workspaceFolders.filter((f) => notIsfs(f.uri) && new AtelierAPI(f.uri).active); - if (options.length == 0) { - vscode.window.showErrorMessage( - "'Extract Documents from XML File...' command requires a non-isfs workspace folder with an active server connection.", - "Dismiss" - ); + // Use the server connection from a workspace folder + wsFolder = await getWsFolder("Pick the workspace folder to run the command in", false, false, true, true); + if (!wsFolder) { + if (wsFolder === undefined) { + // Strict equality needed because undefined == null + vscode.window.showErrorMessage( + "'Extract Documents from XML File...' command requires a non-isfs workspace folder with an active server connection.", + "Dismiss" + ); + } return; - } else if (options.length == 1) { - wsFolder = options[0]; - } else { - // Prompt the user to select a workspace folder - wsFolder = ( - await vscode.window.showQuickPick( - options.map((f) => { - return { label: f.name, wf: f }; - }), - { - ignoreFocusOut: true, - placeHolder: "Pick the workspace folder to run the command in", - } - ) - )?.wf; } } if (!wsFolder) return; @@ -170,7 +157,7 @@ export async function extractXMLFileContents(xmlUri?: vscode.Uri): Promise { canPickMany: true, ignoreFocusOut: true, - title: "Select the documents to extract", + title: "Pick the documents to extract", placeHolder: "Files are created using your 'objectscript.export' settings", } ); diff --git a/src/explorer/explorer.ts b/src/explorer/explorer.ts index 3337140b..09fcf5dd 100644 --- a/src/explorer/explorer.ts +++ b/src/explorer/explorer.ts @@ -155,7 +155,7 @@ export class ObjectScriptExplorerProvider implements vscode.TreeDataProvider data.map((ns) => ({ label: ns }))) .then((data) => vscode.window.showQuickPick(data, { - placeHolder: `Choose a namespace on ${api.config.host}:${api.config.port} to add to the Explorer`, + title: `Pick a namespace on ${api.config.host}:${api.config.port} to add to the Explorer`, }) ) .then((ns) => this.showExtra4Workspace(workspaceFolder, ns.label)) diff --git a/src/extension.ts b/src/extension.ts index 15bebb50..1a000281 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -521,7 +521,7 @@ export async function checkConnection( vscode.window .showInputBox({ password: true, - placeHolder: `Not Authorized. Enter password to connect as user '${username}' to ${connInfo}`, + title: `Not Authorized. Enter password to connect as user '${username}' to ${connInfo}`, prompt: !api.externalServer ? "If no password is entered the connection will be disabled." : "", ignoreFocusOut: true, }) @@ -1052,7 +1052,7 @@ export async function activate(context: vscode.ExtensionContext): Promise { } return vscode.window .showInputBox({ - placeHolder: "Please enter comma delimited arguments list", + title: "Enter comma delimited arguments list", }) .then((args) => { if (args != undefined && args != null) { @@ -1122,7 +1122,7 @@ export async function activate(context: vscode.ExtensionContext): Promise { } return vscode.window .showQuickPick(list, { - placeHolder: `Pick the process to attach to in ${api.ns} on '${api.serverId}'`, + title: `Pick the process to attach to in ${api.ns} on '${api.serverId}'`, matchOnDescription: true, }) .then((value) => { @@ -1541,11 +1541,17 @@ export async function activate(context: vscode.ExtensionContext): Promise { ), vscode.commands.registerCommand("vscode-objectscript.compileIsfs", (uri) => fileSystemProvider.compile(uri)), vscode.commands.registerCommand("vscode-objectscript.openISCDocument", async () => { - const wsFolder = await getWsFolder("Pick the workspace folder where you want to open a document"); + const wsFolder = await getWsFolder( + "Pick the workspace folder where you want to open a document", + false, + false, + false, + true + ); if (!wsFolder) { if (wsFolder === undefined) { // Strict equality needed because undefined == null - vscode.window.showErrorMessage("No workspace folders are open.", "Dismiss"); + vscode.window.showErrorMessage("No workspace folders with an active server connection are open.", "Dismiss"); } return; } diff --git a/src/utils/index.ts b/src/utils/index.ts index 8b1a2a24..8e307aa7 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -824,7 +824,6 @@ export async function getWsServerConnection(minVersion?: string): Promise { if (!vscode.workspace.workspaceFolders?.length) return; // Apply the filters const folders = vscode.workspace.workspaceFolders.filter( (f) => (!writeableOnly || (writeableOnly && vscode.workspace.fs.isWritableFileSystem(f.uri.scheme))) && - (!isfsOnly || (isfsOnly && filesystemSchemas.includes(f.uri.scheme))) + (!isfsOnly || (isfsOnly && filesystemSchemas.includes(f.uri.scheme))) && + (!notIsfsOnly || (notIsfsOnly && notIsfs(f.uri))) && + (!active || (active && new AtelierAPI(f.uri).active)) ); if (!folders.length) return; if (folders.length == 1) return folders[0]; @@ -864,7 +869,6 @@ export async function getWsFolder( }), { canPickMany: false, - ignoreFocusOut: true, matchOnDetail: true, title: title || "Pick a workspace folder", }