@@ -2,7 +2,7 @@ import * as vscode from "vscode";
2
2
import path = require( "path" ) ;
3
3
import { config , OBJECTSCRIPTXML_FILE_SCHEMA , xmlContentProvider } from "../extension" ;
4
4
import { AtelierAPI } from "../api" ;
5
- import { fileExists , handleError , notIsfs , outputChannel } from "../utils" ;
5
+ import { fileExists , getWsFolder , handleError , notIsfs , outputChannel } from "../utils" ;
6
6
import { getFileName } from "./export" ;
7
7
8
8
const exportHeader = / ^ \s * < E x p o r t g e n e r a t o r = " ( C a c h e | I R I S ) " v e r s i o n = " \d + " / ;
@@ -33,7 +33,6 @@ export async function previewXMLAsUDL(textEditor: vscode.TextEditor, auto = fals
33
33
} ) ,
34
34
{
35
35
canPickMany : true ,
36
- ignoreFocusOut : true ,
37
36
title : "Select the documents to preview" ,
38
37
}
39
38
) ;
@@ -96,29 +95,17 @@ export async function extractXMLFileContents(xmlUri?: vscode.Uri): Promise<void>
96
95
if ( xmlUri ) {
97
96
wsFolder = vscode . workspace . getWorkspaceFolder ( xmlUri ) ;
98
97
} 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
+ }
106
108
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
- title : "Pick the workspace folder to run the command in" ,
119
- }
120
- )
121
- ) ?. wf ;
122
109
}
123
110
}
124
111
if ( ! wsFolder ) return ;
0 commit comments