@@ -31,6 +31,7 @@ class _AuxFile(object):
3131 def __init__ (
3232 self ,
3333 file_path ,
34+ coq_lsp_options : Tuple [str ],
3435 copy : bool = False ,
3536 workspace : Optional [str ] = None ,
3637 timeout : int = 30 ,
@@ -41,7 +42,9 @@ def __init__(
4142 uri = f"file://{ workspace } "
4243 else :
4344 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+ )
4548
4649 def __enter__ (self ):
4750 return self
@@ -167,11 +170,16 @@ def __load_library(
167170 library_file : str ,
168171 library_hash : str ,
169172 timeout : int ,
173+ coq_lsp_options : Tuple [str ] = None ,
170174 workspace : Optional [str ] = None ,
171175 ):
172176 # NOTE: the library_hash attribute is only used for the LRU cache
173177 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 ,
175183 )
176184 coq_file .run ()
177185 context = coq_file .context
@@ -221,6 +229,7 @@ def get_library(
221229 library_name : str ,
222230 library_file : str ,
223231 timeout : int ,
232+ coq_lsp_options : Tuple [str ],
224233 workspace : Optional [str ] = None ,
225234 use_disk_cache : bool = False ,
226235 ) -> Dict [str , Term ]:
@@ -232,7 +241,12 @@ def get_library(
232241 if cached_library is not None :
233242 return cached_library
234243 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 ,
236250 )
237251 # FIXME: we ignore the usage of "Local" from imported files to
238252 # simplify the implementation. However, they can be used:
@@ -260,13 +274,18 @@ def get_libraries(aux_file: "_AuxFile") -> List[str]:
260274
261275 @staticmethod
262276 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 ,
264281 ) -> FileContext :
265282 temp_path = os .path .join (
266283 tempfile .gettempdir (), "aux_" + str (uuid .uuid4 ()).replace ("-" , "" ) + ".v"
267284 )
268285
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 :
270289 aux_file .didOpen ()
271290 libraries = _AuxFile .get_libraries (aux_file )
272291 for library in libraries :
@@ -284,6 +303,7 @@ def get_coq_context(
284303 timeout ,
285304 workspace = workspace ,
286305 use_disk_cache = use_disk_cache ,
306+ coq_lsp_options = coq_lsp_options ,
287307 )
288308 context .add_library (library , terms )
289309
@@ -304,6 +324,7 @@ def __init__(
304324 timeout : int = 30 ,
305325 workspace : Optional [str ] = None ,
306326 coq_lsp : str = "coq-lsp" ,
327+ coq_lsp_options : Tuple [str ] = None ,
307328 coqtop : str = "coqtop" ,
308329 error_mode : str = "strict" ,
309330 use_disk_cache : bool = False ,
@@ -333,18 +354,33 @@ def __init__(
333354 """
334355 if not os .path .isabs (file_path ):
335356 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+ )
338372 self .__error_mode = error_mode
339373 self .__use_disk_cache = use_disk_cache
340374 self .__aux_file .didOpen ()
375+ self .__coq_lsp_options = coq_lsp_options
341376
342377 try :
343378 # We need to update the context already defined in the CoqFile
344379 self .context .update (
345380 _AuxFile .get_coq_context (
346381 self .timeout ,
347382 workspace = self .workspace ,
383+ coq_lsp_options = coq_lsp_options ,
348384 use_disk_cache = self .__use_disk_cache ,
349385 )
350386 )
@@ -612,6 +648,7 @@ def __update_libraries(self):
612648 library ,
613649 library_file ,
614650 self .timeout ,
651+ self .__coq_lsp_options ,
615652 workspace = self .workspace ,
616653 use_disk_cache = self .__use_disk_cache ,
617654 )
0 commit comments