The changes align the project with the 2025.0.0 lsprotocol release, removing the old backport and updating type hints in the protocol hooks to use Sequence where appropriate. The dist-info and packaging metadata for older lsprotocol versions are replaced with the new 2025.0.0 artifacts. - Remove exceptiongroup backport used on Python <3.11 - Use Sequence instead of List in LS protocol hooks - Replace old dist-info with 2025.0.0 metadata
27 lines
853 B
Python
27 lines
853 B
Python
"""Shared pytest setup for the language server."""
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
THIS_DIR = Path(__file__).parent
|
|
SRC_DIR = THIS_DIR.parent.parent / "src"
|
|
if str(SRC_DIR) not in sys.path:
|
|
sys.path.insert(0, str(SRC_DIR))
|
|
|
|
import lsprotocol.types as lsp # type: ignore # noqa: E402
|
|
from lsp_server import LSP_SERVER # type: ignore # noqa: E402
|
|
from pygls.workspace import Workspace # noqa: E402
|
|
|
|
|
|
@pytest.fixture(scope="session", autouse=True)
|
|
def initialize_test_workspace() -> None:
|
|
"""Provide the workspace that pygls 2 creates during LSP initialization."""
|
|
LSP_SERVER.protocol._workspace = Workspace( # pylint: disable=protected-access
|
|
root_uri=None,
|
|
sync_kind=lsp.TextDocumentSyncKind.Incremental,
|
|
workspace_folders=[],
|
|
position_encoding=lsp.PositionEncodingKind.Utf16,
|
|
)
|