@@ -31,6 +31,7 @@ class _AuxFile(object):
31
31
def __init__ (
32
32
self ,
33
33
file_path ,
34
+ coq_lsp_options : Tuple [str ],
34
35
copy : bool = False ,
35
36
workspace : Optional [str ] = None ,
36
37
timeout : int = 30 ,
@@ -41,7 +42,9 @@ def __init__(
41
42
uri = f"file://{ workspace } "
42
43
else :
43
44
uri = f"file://{ self .path } "
44
- self .coq_lsp_client = CoqLspClient (uri , timeout = timeout )
45
+ self .coq_lsp_client = CoqLspClient (
46
+ uri , coq_lsp_options = coq_lsp_options , timeout = timeout
47
+ )
45
48
46
49
def __enter__ (self ):
47
50
return self
@@ -167,11 +170,16 @@ def __load_library(
167
170
library_file : str ,
168
171
library_hash : str ,
169
172
timeout : int ,
173
+ coq_lsp_options : Tuple [str ] = None ,
170
174
workspace : Optional [str ] = None ,
171
175
):
172
176
# NOTE: the library_hash attribute is only used for the LRU cache
173
177
coq_file = CoqFile (
174
- library_file , workspace = workspace , library = library_name , timeout = timeout
178
+ library_file ,
179
+ workspace = workspace ,
180
+ coq_lsp_options = coq_lsp_options ,
181
+ library = library_name ,
182
+ timeout = timeout ,
175
183
)
176
184
coq_file .run ()
177
185
context = coq_file .context
@@ -221,6 +229,7 @@ def get_library(
221
229
library_name : str ,
222
230
library_file : str ,
223
231
timeout : int ,
232
+ coq_lsp_options : Tuple [str ],
224
233
workspace : Optional [str ] = None ,
225
234
use_disk_cache : bool = False ,
226
235
) -> Dict [str , Term ]:
@@ -232,7 +241,12 @@ def get_library(
232
241
if cached_library is not None :
233
242
return cached_library
234
243
aux_context = _AuxFile .__load_library (
235
- library_name , library_file , library_hash , timeout , workspace = workspace
244
+ library_name ,
245
+ library_file ,
246
+ library_hash ,
247
+ timeout ,
248
+ coq_lsp_options ,
249
+ workspace = workspace ,
236
250
)
237
251
# FIXME: we ignore the usage of "Local" from imported files to
238
252
# simplify the implementation. However, they can be used:
@@ -260,13 +274,18 @@ def get_libraries(aux_file: "_AuxFile") -> List[str]:
260
274
261
275
@staticmethod
262
276
def get_coq_context (
263
- timeout : int , workspace : Optional [str ] = None , use_disk_cache : bool = False
277
+ timeout : int ,
278
+ workspace : Optional [str ] = None ,
279
+ use_disk_cache : bool = False ,
280
+ coq_lsp_options : Tuple [str ] = None ,
264
281
) -> FileContext :
265
282
temp_path = os .path .join (
266
283
tempfile .gettempdir (), "aux_" + str (uuid .uuid4 ()).replace ("-" , "" ) + ".v"
267
284
)
268
285
269
- with _AuxFile (file_path = temp_path , timeout = timeout ) as aux_file :
286
+ with _AuxFile (
287
+ file_path = temp_path , coq_lsp_options = coq_lsp_options , timeout = timeout
288
+ ) as aux_file :
270
289
aux_file .didOpen ()
271
290
libraries = _AuxFile .get_libraries (aux_file )
272
291
for library in libraries :
@@ -284,6 +303,7 @@ def get_coq_context(
284
303
timeout ,
285
304
workspace = workspace ,
286
305
use_disk_cache = use_disk_cache ,
306
+ coq_lsp_options = coq_lsp_options ,
287
307
)
288
308
context .add_library (library , terms )
289
309
@@ -304,6 +324,7 @@ def __init__(
304
324
timeout : int = 30 ,
305
325
workspace : Optional [str ] = None ,
306
326
coq_lsp : str = "coq-lsp" ,
327
+ coq_lsp_options : Tuple [str ] = None ,
307
328
coqtop : str = "coqtop" ,
308
329
error_mode : str = "strict" ,
309
330
use_disk_cache : bool = False ,
@@ -333,18 +354,33 @@ def __init__(
333
354
"""
334
355
if not os .path .isabs (file_path ):
335
356
file_path = os .path .abspath (file_path )
336
- super ().__init__ (file_path , library , timeout , workspace , coq_lsp , coqtop )
337
- self .__aux_file = _AuxFile (file_path , timeout = self .timeout , workspace = workspace )
357
+ super ().__init__ (
358
+ file_path ,
359
+ library = library ,
360
+ timeout = timeout ,
361
+ workspace = workspace ,
362
+ coq_lsp = coq_lsp ,
363
+ coqtop = coqtop ,
364
+ coq_lsp_options = coq_lsp_options ,
365
+ )
366
+ self .__aux_file = _AuxFile (
367
+ file_path ,
368
+ timeout = self .timeout ,
369
+ coq_lsp_options = coq_lsp_options ,
370
+ workspace = workspace ,
371
+ )
338
372
self .__error_mode = error_mode
339
373
self .__use_disk_cache = use_disk_cache
340
374
self .__aux_file .didOpen ()
375
+ self .__coq_lsp_options = coq_lsp_options
341
376
342
377
try :
343
378
# We need to update the context already defined in the CoqFile
344
379
self .context .update (
345
380
_AuxFile .get_coq_context (
346
381
self .timeout ,
347
382
workspace = self .workspace ,
383
+ coq_lsp_options = coq_lsp_options ,
348
384
use_disk_cache = self .__use_disk_cache ,
349
385
)
350
386
)
@@ -612,6 +648,7 @@ def __update_libraries(self):
612
648
library ,
613
649
library_file ,
614
650
self .timeout ,
651
+ self .__coq_lsp_options ,
615
652
workspace = self .workspace ,
616
653
use_disk_cache = self .__use_disk_cache ,
617
654
)
0 commit comments