Move definitions from multilspy.language_server to solidlsp

This commit is contained in:
Dominik Jain
2025-06-23 16:38:11 +02:00
parent c2593a1171
commit 541998e912
2 changed files with 41 additions and 40 deletions
-38
View File
@@ -51,44 +51,6 @@ from serena.text_utils import MatchedConsecutiveLines, search_files
GenericDocumentSymbol = Union[LSPTypes.DocumentSymbol, LSPTypes.SymbolInformation, multilspy_types.UnifiedSymbolInformation]
@dataclasses.dataclass(kw_only=True)
class ReferenceInSymbol:
"""A symbol retrieved when requesting reference to a symbol, together with the location of the reference"""
symbol: multilspy_types.UnifiedSymbolInformation
line: int
character: int
@dataclasses.dataclass
class LSPFileBuffer:
"""
This class is used to store the contents of an open LSP file in memory.
"""
# uri of the file
uri: str
# The contents of the file
contents: str
# The version of the file
version: int
# The language id of the file
language_id: str
# reference count of the file
ref_count: int
# --------------------------------- MODIFICATIONS BY MISCHA ---------------------------------
content_hash: str = ""
def __post_init__(self):
self.content_hash = hashlib.md5(self.contents.encode('utf-8')).hexdigest()
class LanguageServer:
"""
The LanguageServer class provides a language agnostic interface to the Language Server Protocol.
+41 -2
View File
@@ -1,3 +1,5 @@
import dataclasses
import hashlib
import json
import logging
import os
@@ -11,12 +13,11 @@ from collections.abc import Iterator
from contextlib import contextmanager
from copy import copy
from pathlib import Path, PurePath
from typing import Self, cast
from typing import Self, Union, cast
import pathspec
import tqdm
from multilspy.language_server import GenericDocumentSymbol, LSPFileBuffer, ReferenceInSymbol
from serena.text_utils import MatchedConsecutiveLines, search_files
from solidlsp import multilspy_types
from solidlsp.ls_handler import SolidLanguageServerHandler
@@ -34,6 +35,44 @@ from solidlsp.multilspy_exceptions import MultilspyException
from solidlsp.multilspy_logger import MultilspyLogger
from solidlsp.multilspy_utils import FileUtils, PathUtils, TextUtils
GenericDocumentSymbol = Union[LSPTypes.DocumentSymbol, LSPTypes.SymbolInformation, multilspy_types.UnifiedSymbolInformation]
@dataclasses.dataclass(kw_only=True)
class ReferenceInSymbol:
"""A symbol retrieved when requesting reference to a symbol, together with the location of the reference"""
symbol: multilspy_types.UnifiedSymbolInformation
line: int
character: int
@dataclasses.dataclass
class LSPFileBuffer:
"""
This class is used to store the contents of an open LSP file in memory.
"""
# uri of the file
uri: str
# The contents of the file
contents: str
# The version of the file
version: int
# The language id of the file
language_id: str
# reference count of the file
ref_count: int
content_hash: str = ""
def __post_init__(self):
self.content_hash = hashlib.md5(self.contents.encode("utf-8")).hexdigest()
class SolidLanguageServer(ABC):
"""