mirror of
https://github.com/tiennm99/serena.git
synced 2026-10-12 22:14:54 +00:00
Clean up language server settings classes, improving docstrings
This commit is contained in:
1 parent
352b3d3fed
commit
fd91dd10f6
3 files changed
+12
-11
No files matched your search
+2
-3
@@ -638,9 +638,8 @@ class SolidLanguageServer(ABC):
|
||||
repository_root_path = os.path.abspath(repository_root_path)
|
||||
|
||||
ls_class = config.code_language.get_ls_class()
|
||||
# For now, we assume that all language server implementations have the same signature of the constructor
|
||||
# (which, unfortunately, differs from the signature of the base class).
|
||||
# If this assumption is ever violated, we need branching logic here.
|
||||
# All language server implementations are required to use the same signature of the constructor
|
||||
# (which differs from the signature of the base class constructor).
|
||||
ls = ls_class(config, repository_root_path, solidlsp_settings)
|
||||
ls.set_request_timeout(timeout)
|
||||
return ls
|
||||
|
||||
@@ -834,10 +834,13 @@ class Language(str, Enum):
|
||||
@dataclass(frozen=True)
|
||||
class LanguageServerConfig:
|
||||
"""
|
||||
Configuration parameters
|
||||
Configuration parameters for a language server instance
|
||||
"""
|
||||
|
||||
code_language: Language
|
||||
"""
|
||||
defines the language server to use
|
||||
"""
|
||||
workspace_folders: list[str] = field(default_factory=lambda: ["."])
|
||||
"""
|
||||
list of workspace folders to be used by the language server and to be fully indexed by SolidLSP.
|
||||
|
||||
@@ -18,6 +18,12 @@ log = logging.getLogger(__name__)
|
||||
|
||||
@dataclass
|
||||
class SolidLSPSettings:
|
||||
"""
|
||||
Configures SolidLSP-specific data storage as well as global settings.
|
||||
|
||||
Note: Server instance-specific settings belong in LanguageServerConfig, not here.
|
||||
"""
|
||||
|
||||
solidlsp_dir: str = str(pathlib.Path.home() / ".solidlsp")
|
||||
"""
|
||||
Path to the directory in which to store global Solid-LSP data (which is not project-specific)
|
||||
@@ -34,13 +40,6 @@ class SolidLSPSettings:
|
||||
Have a look at the docstring of the constructors of the corresponding LS implementations within solidlsp to see which options are available.
|
||||
No documentation on options means no options are available.
|
||||
"""
|
||||
additional_workspace_folders: list[str] = field(default_factory=list)
|
||||
"""
|
||||
Additional workspace folder paths for cross-package reference support.
|
||||
Paths can be absolute or relative to the project root. Each folder is added as a workspace
|
||||
folder in the LSP initialization, enabling language servers to discover symbols and references
|
||||
across package boundaries (e.g. in monorepos).
|
||||
"""
|
||||
|
||||
def __post_init__(self) -> None:
|
||||
os.makedirs(str(self.solidlsp_dir), exist_ok=True)
|
||||
|
||||
Reference in new issue
Block a user