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:
@@ -3,13 +3,18 @@ from __future__ import annotations
|
||||
import contextlib
|
||||
import re
|
||||
from dataclasses import dataclass
|
||||
from typing import Generator, Mapping, NoReturn
|
||||
from typing import TYPE_CHECKING, NoReturn
|
||||
|
||||
from .specifiers import Specifier
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from collections.abc import Generator, Mapping
|
||||
|
||||
|
||||
@dataclass
|
||||
class Token:
|
||||
__slots__ = ("name", "position", "text")
|
||||
|
||||
name: str
|
||||
text: str
|
||||
position: int
|
||||
@@ -84,7 +89,7 @@ DEFAULT_RULES: dict[str, re.Pattern[str]] = {
|
||||
"VERSION_PREFIX_TRAIL": re.compile(r"\.\*"),
|
||||
"VERSION_LOCAL_LABEL_TRAIL": re.compile(r"\+[a-z0-9]+(?:[-_\.][a-z0-9]+)*"),
|
||||
"WS": re.compile(r"[ \t]+"),
|
||||
"END": re.compile(r"$"),
|
||||
"END": re.compile(r"\Z"),
|
||||
}
|
||||
|
||||
|
||||
@@ -95,6 +100,8 @@ class Tokenizer:
|
||||
matches.
|
||||
"""
|
||||
|
||||
__slots__ = ("next_token", "position", "rules", "source")
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
source: str,
|
||||
@@ -135,7 +142,7 @@ class Tokenizer:
|
||||
def expect(self, name: str, *, expected: str) -> Token:
|
||||
"""Expect a certain token name next, failing with a syntax error otherwise.
|
||||
|
||||
The token is *not* read.
|
||||
The token is read and returned.
|
||||
"""
|
||||
if not self.check(name):
|
||||
raise self.raise_syntax_error(f"Expected {expected}")
|
||||
|
||||
Reference in New Issue
Block a user