@@ -250,11 +250,17 @@ export async function loadChanges(files: (CurrentTextFile | CurrentBinaryFile)[]
250250 ) ;
251251}
252252
253- export async function compile ( docs : ( CurrentTextFile | CurrentBinaryFile ) [ ] ) : Promise < any > {
253+ export async function compile ( docs : ( CurrentTextFile | CurrentBinaryFile ) [ ] , askFlags = false ) : Promise < any > {
254254 docs = docs . filter ( notNull ) ;
255255 if ( ! docs . length ) return ;
256256 const wsFolder = vscode . workspace . getWorkspaceFolder ( docs [ 0 ] . uri ) ;
257- const flags = vscode . workspace . getConfiguration ( "objectscript" , wsFolder || docs [ 0 ] . uri ) . get < string > ( "compileFlags" ) ;
257+ const defaultFlags = vscode . workspace
258+ . getConfiguration ( "objectscript" , wsFolder || docs [ 0 ] . uri )
259+ . get < string > ( "compileFlags" ) ;
260+ const flags = askFlags
261+ ? await vscode . window . showInputBox ( { title : "Enter compilation flags and qualifiers" , value : defaultFlags } )
262+ : defaultFlags ;
263+ if ( flags == undefined ) return ; // User clicked out of input box
258264 const api = new AtelierAPI ( docs [ 0 ] . uri ) ;
259265 const docNames = docs . map ( ( d ) => d . name ) ;
260266 // Determine the line ending to use for other documents affected
@@ -305,7 +311,7 @@ export async function compile(docs: (CurrentTextFile | CurrentBinaryFile)[]): Pr
305311 . then ( loadChanges ) ;
306312}
307313
308- export async function importAndCompile ( document ?: vscode . TextDocument ) : Promise < any > {
314+ export async function importAndCompile ( document ?: vscode . TextDocument , askFlags = false ) : Promise < any > {
309315 const file = currentFile ( document ) ;
310316 if ( ! file || filesystemSchemas . includes ( file . uri . scheme ) || ! new AtelierAPI ( file . uri ) . active ) {
311317 // Not for server-side URIs or folders with inactive server connections
@@ -315,14 +321,14 @@ export async function importAndCompile(document?: vscode.TextDocument): Promise<
315321 return (
316322 importFile ( file )
317323 . then ( ( ) => {
318- if ( isCompilable ( file . name ) ) compile ( [ file ] ) ;
324+ if ( isCompilable ( file . name ) ) compile ( [ file ] , askFlags ) ;
319325 } )
320326 // importFile handles any server errors
321327 . catch ( ( ) => { } )
322328 ) ;
323329}
324330
325- export async function compileOnly ( document ?: vscode . TextDocument ) : Promise < any > {
331+ export async function compileOnly ( document ?: vscode . TextDocument , askFlags = false ) : Promise < any > {
326332 document =
327333 document ||
328334 ( vscode . window . activeTextEditor && vscode . window . activeTextEditor . document
@@ -338,7 +344,7 @@ export async function compileOnly(document?: vscode.TextDocument): Promise<any>
338344 return ;
339345 }
340346
341- if ( isCompilable ( file . name ) ) compile ( [ file ] ) ;
347+ if ( isCompilable ( file . name ) ) compile ( [ file ] , askFlags ) ;
342348}
343349
344350// Compiles all files types in the namespace
0 commit comments