blob: 8b4258231adf08d594ae4e5b15c6688d81f32d05 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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<test>")
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)
|