99import pathlib
1010import subprocess
1111import time
12- import wrapt
1312from collections import defaultdict
1413from pathlib import Path
1514from threading import Thread
16- from typing import Any
15+ from typing import Any , List
1716from unittest .mock import patch
1817
1918import pytest
@@ -386,7 +385,7 @@ def client_server() -> Any:
386385 def _hook (ls , params ):
387386 os .system ("notify-send configuration" )
388387 log .error ("PLLLLLLLLLLLLLLLLLLLLLLLZ" )
389- configuration_hook (ls , params )
388+ return configuration_hook (ls , params )
390389
391390 client_thread = Thread (
392391 target = start_editor ,
@@ -431,6 +430,18 @@ def _deserialize_params(data, get_params_type):
431430 log .error (f"{ dir (client )= } " )
432431 log .error (f"{ dir (client .lsp )= } " )
433432
433+ original_get_method_return_type = pygls .lsp .get_method_return_type
434+
435+ # pylint: disable=dangerous-default-value
436+ def _get_method_return_type (method_name , lsp_methods_map = LSP_METHODS_MAP ):
437+ if method_name == methods .WORKSPACE_CONFIGURATION :
438+ log .warning (
439+ "[TESTS] We are altering the return value for get_method_return_type"
440+ )
441+ return List [Any ]
442+
443+ return original_get_method_return_type (method_name , lsp_methods_map )
444+
434445 # patch("pygls.protocol.pygls.lsp.LSP_METHODS_MAP", new_methods_map).start()
435446 # patch("pygls.protocol.LSP_METHODS_MAP", new_methods_map).start()
436447 # patch("pygls.lsp.LSP_METHODS_MAP", new_methods_map).start()
@@ -439,6 +450,8 @@ def _deserialize_params(data, get_params_type):
439450 # patch("pygls.protocol.LSP_METHODS_MAP", new_methods_map).start()
440451 # patch("pygls.lsp.get_method_return_type", _params).start()
441452 patch ("pygls.protocol.deserialize_params" , _deserialize_params ).start ()
453+ patch ("pygls.protocol.get_method_return_type" , _get_method_return_type ).start ()
454+ # patch("pygls.protocol.get_method_params_type", _raise).start()
442455 # patch("pygls.protocol.get_method_return_type", _params).start()
443456 # patch("pygls.protocol.pygls.lsp.get_method_return_type", _params).start()
444457
0 commit comments