chore(lsprotocol): migrate to 2025.0.0 and cleanup artifacts

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
This commit is contained in:
Christoph Brandau
2026-09-03 08:39:12 +02:00
parent a0a0d38fe5
commit 53ebc5d055
101 changed files with 13838 additions and 7624 deletions
+18 -5
View File
@@ -55,13 +55,21 @@ def get_help_attrs(f):
)
def has_ls_param_or_annotation(f, annotation):
"""Returns true if callable has first parameter named `ls` or type of
annotation"""
def has_ls_param_or_annotation(f, actual_type):
"""Returns true if the given callable's first parameter is
- named `ls`
- has a type annotation compatible with the given type
"""
try:
sig = inspect.signature(f)
first_p = next(itertools.islice(sig.parameters.values(), 0, 1))
return first_p.name == PARAM_LS or get_type_hints(f)[first_p.name] == annotation
if first_p.name == PARAM_LS:
return True
expected_type = get_type_hints(f)[first_p.name]
return issubclass(actual_type, expected_type)
except Exception:
return False
@@ -80,6 +88,10 @@ def wrap_with_server(f, server):
async def wrapped(*args, **kwargs):
return await f(server, *args, **kwargs)
# Used by `workspace/executeCommand` to access the original function's
# signature. Mirrors how functools.partial works.
wrapped.func = f # type: ignore[attr-defined]
else:
wrapped = functools.partial(f, server)
if is_thread_function(f):
@@ -196,7 +208,8 @@ class FeatureManager:
raise TypeError(
(
f'Options of method "{feature_name}"'
f" should be instance of type {options_type}"
f" is instance of type {type(options)}"
f" which is not a subtype of {options_type}"
)
)
self._feature_options[feature_name] = options