@@ -55,7 +55,7 @@ export default class gnatproveTaskProvider implements vscode.TaskProvider<vscode
55
55
56
56
// Arguments for proof of selected region need to be evaluated here
57
57
if ( definition . taskKind == taskKinds . proveRegion ) {
58
- const args = getGnatproveArgs ( '${config:ada.projectFile}' , [ '-u' , '${fileBasename}' , '--limit-region=${fileBasename}:' + getSelectedRegion ( vscode . window . activeTextEditor ) ] ) ;
58
+ const args = getGnatproveArgs ( [ '-u' , '${fileBasename}' , '--limit-region=${fileBasename}:' + getSelectedRegion ( vscode . window . activeTextEditor ) ] ) ;
59
59
const shell = new vscode . ShellExecution ( 'gnatprove' , args ) ;
60
60
return new vscode . Task ( definition , vscode . TaskScope . Workspace , task . name , 'ada' , shell , '$ada' ) ;
61
61
}
@@ -67,7 +67,7 @@ export default class gnatproveTaskProvider implements vscode.TaskProvider<vscode
67
67
. then ( subprogram =>
68
68
{
69
69
let args = ( definition . taskKind == taskKinds . examineSubprogram ) ? [ '--mode=flow' ] : [ ] ;
70
- args = getGnatproveArgs ( '${config:ada.projectFile}' , args . concat ( [ '-u' , '${fileBasename}' , '--limit-subp=${fileBasename}:' + subprogram ] ) ) ;
70
+ args = getGnatproveArgs ( args . concat ( [ '-u' , '${fileBasename}' , '--limit-subp=${fileBasename}:' + subprogram ] ) ) ;
71
71
const shell = new vscode . ShellExecution ( 'gnatprove' , args ) ;
72
72
return new vscode . Task ( definition , vscode . TaskScope . Workspace , task . name , 'ada' , shell , '$ada' ) ;
73
73
} ) ;
@@ -96,14 +96,14 @@ const getTasks = (): vscode.Task[] => {
96
96
// Examine the project
97
97
const examineProject = makeTask (
98
98
taskKinds . examineProject ,
99
- getGnatproveArgs ( '${config:ada.projectFile}' , [ '--mode=flow' ] ) ,
99
+ getGnatproveArgs ( [ '--mode=flow' ] ) ,
100
100
'Examine project'
101
101
) ;
102
102
103
103
// Examine the file
104
104
const examineFile = makeTask (
105
105
taskKinds . examineFile ,
106
- getGnatproveArgs ( '${config:ada.projectFile}' , [ '--mode=flow' , '-u' , '${fileBasename}' ] ) ,
106
+ getGnatproveArgs ( [ '--mode=flow' , '-u' , '${fileBasename}' ] ) ,
107
107
'Examine file'
108
108
) ;
109
109
@@ -117,14 +117,14 @@ const getTasks = (): vscode.Task[] => {
117
117
// Prove the project
118
118
const proveProject = makeTask (
119
119
taskKinds . proveProject ,
120
- getGnatproveArgs ( '${config:ada.projectFile}' , [ ] ) ,
120
+ getGnatproveArgs ( [ ] ) ,
121
121
'Prove project'
122
122
) ;
123
123
124
124
// Prove the file
125
125
const proveFile = makeTask (
126
126
taskKinds . proveFile ,
127
- getGnatproveArgs ( '${config:ada.projectFile}' , [ '-u' , '${fileBasename}' ] ) ,
127
+ getGnatproveArgs ( [ '-u' , '${fileBasename}' ] ) ,
128
128
'Prove file'
129
129
) ;
130
130
@@ -145,7 +145,7 @@ const getTasks = (): vscode.Task[] => {
145
145
// Prove the selected line line
146
146
const proveLine = makeTask (
147
147
taskKinds . proveLine ,
148
- getGnatproveArgs ( '${config:ada.projectFile}' , [ '-u' , '${fileBasename}' , '--limit-line=${fileBasename}:${lineNumber}' ] ) ,
148
+ getGnatproveArgs ( [ '-u' , '${fileBasename}' , '--limit-line=${fileBasename}:${lineNumber}' ] ) ,
149
149
'Prove line'
150
150
) ;
151
151
@@ -208,23 +208,26 @@ const getSelectedRegion = (editor: vscode.TextEditor | undefined): string => {
208
208
}
209
209
} ;
210
210
211
- const getGnatproveArgs = ( projectFile : string , args : string [ ] ) : string [ ] => {
211
+ const getGnatproveArgs = ( args : string [ ] ) : string [ ] => {
212
212
// Append args (if any) and `-gnatef` to generate full file names in errors/warnings
213
213
const p_gnatef = [ '-cargs' , '-gnatef' ] ;
214
- return commonArgs ( projectFile ) . concat ( args , p_gnatef ) ;
214
+ return commonArgs ( ) . concat ( args , p_gnatef ) ;
215
215
} ;
216
216
217
- // return '-P project.gpr -XVAR=value` optiona
218
- const commonArgs = ( projectFile ?: string ) : string [ ] => {
217
+ // return '-P project.gpr -XVAR=value` options
218
+ const commonArgs = ( ) : string [ ] => {
219
219
const vars : string [ ] [ ] = Object . entries (
220
220
vscode . workspace . getConfiguration ( 'ada' ) . get ( 'scenarioVariables' ) ?? [ ]
221
221
) ;
222
222
const fold = ( args : string [ ] , item : string [ ] ) : string [ ] => {
223
223
const option = '-X' + item [ 0 ] + '=' + item [ 1 ] ;
224
224
return args . concat ( [ option ] ) ;
225
225
} ;
226
+
226
227
// Set projectFile is any
227
- const prj = projectFile ? [ '-P' , projectFile ] : [ ] ;
228
+ const prj = vscode . workspace . getConfiguration ( 'ada' ) . get (
229
+ 'projectFile' ) != "" ? [ '-P' , "${config:ada.projectFile}" ] : [ ] ;
230
+
228
231
// for each scenarioVariables put `-Xname=value` option
229
232
return vars . reduce ( fold , prj ) ;
230
233
} ;
0 commit comments