Skip to content

Commit c1c2eee

Browse files
committed
WORKS!!!!
1 parent 26788cd commit c1c2eee

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

pytest-yls/pytest_yls/plugin.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@
99
import pathlib
1010
import subprocess
1111
import time
12-
import wrapt
1312
from collections import defaultdict
1413
from pathlib import Path
1514
from threading import Thread
16-
from typing import Any
15+
from typing import Any, List
1716
from unittest.mock import patch
1817

1918
import 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

Comments
 (0)