From 7a7c8ddc4a4432907f433fdef3f0a233c790780f Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 14 Apr 2024 22:16:54 +0200 Subject: Merging upstream version 0.1.25. Signed-off-by: Daniel Baumann --- tests/lsp_tests/conftest.py | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 tests/lsp_tests/conftest.py (limited to 'tests/lsp_tests/conftest.py') diff --git a/tests/lsp_tests/conftest.py b/tests/lsp_tests/conftest.py new file mode 100644 index 0000000..8b42582 --- /dev/null +++ b/tests/lsp_tests/conftest.py @@ -0,0 +1,43 @@ +import pytest +from debputy.plugin.api.feature_set import PluginProvidedFeatureSet + +try: + from pygls.server import LanguageServer + from lsprotocol.types import ( + InitializeParams, + ClientCapabilities, + GeneralClientCapabilities, + PositionEncodingKind, + TextDocumentItem, + Position, + CompletionParams, + TextDocumentIdentifier, + HoverParams, + MarkupContent, + ) + from debputy.lsp.lsp_features import lsp_set_plugin_features + + HAS_PYGLS = True +except ImportError: + HAS_PYGLS = False + + +@pytest.fixture() +def ls(debputy_plugin_feature_set: PluginProvidedFeatureSet) -> "LanguageServer": + if not HAS_PYGLS: + pytest.skip("Missing pygls") + ls = LanguageServer("debputy", "v") + ls.lsp.lsp_initialize( + InitializeParams( + ClientCapabilities( + general=GeneralClientCapabilities( + position_encodings=[PositionEncodingKind.Utf32], + ) + ) + ) + ) + lsp_set_plugin_features(debputy_plugin_feature_set) + try: + yield ls + finally: + lsp_set_plugin_features(None) -- cgit v1.2.3