Format, removed unused vars

This commit is contained in:
Michael Panchenko authored and Michael Panchenko committed 2025-07-06 23:15:33 +02:00
1 parent bb595eb7e7
commit 1f38ec5f7b
9 files changed
+22 -36

No files matched your search

@@ -11,11 +11,11 @@ import threading
from solidlsp.ls import SolidLanguageServer
from solidlsp.ls_config import LanguageServerConfig
from solidlsp.ls_logger import LanguageServerLogger
from solidlsp.ls_utils import FileUtils, PlatformUtils
from .common import RuntimeDependency, RuntimeDependencyCollection
from solidlsp.lsp_protocol_handler.lsp_types import InitializeParams
from solidlsp.lsp_protocol_handler.server import ProcessLaunchInfo
from .common import RuntimeDependency, RuntimeDependencyCollection
class ClangdLanguageServer(SolidLanguageServer):
"""
@@ -46,8 +46,6 @@ class ClangdLanguageServer(SolidLanguageServer):
"""
Setup runtime dependencies for ClangdLanguageServer and return the command to start the server.
"""
platform_id = PlatformUtils.get_platform_id()
deps = RuntimeDependencyCollection(
[
RuntimeDependency(
+2 -2
View File
@@ -13,11 +13,11 @@ import threading
from solidlsp.ls import SolidLanguageServer
from solidlsp.ls_config import LanguageServerConfig
from solidlsp.ls_logger import LanguageServerLogger
from solidlsp.ls_utils import FileUtils, PlatformUtils
from .common import RuntimeDependency, RuntimeDependencyCollection
from solidlsp.lsp_protocol_handler.lsp_types import InitializeParams
from solidlsp.lsp_protocol_handler.server import ProcessLaunchInfo
from .common import RuntimeDependency, RuntimeDependencyCollection
def run_command(cmd: list, capture_output: bool = True) -> subprocess.CompletedProcess:
return subprocess.run(
+5 -11
View File
@@ -2,8 +2,8 @@ from __future__ import annotations
import os
import subprocess
from collections.abc import Sequence
from dataclasses import dataclass
from typing import Sequence, Dict
from solidlsp.ls_logger import LanguageServerLogger
from solidlsp.ls_utils import FileUtils, PlatformUtils
@@ -32,11 +32,7 @@ class RuntimeDependencyCollection:
self._dependencies = list(dependencies)
def for_platform(self, platform_id: str) -> list[RuntimeDependency]:
return [
d
for d in self._dependencies
if d.platform_id in (platform_id, "any", "platform-agnostic", None)
]
return [d for d in self._dependencies if d.platform_id in (platform_id, "any", "platform-agnostic", None)]
def for_current_platform(self) -> list[RuntimeDependency]:
return self.for_platform(PlatformUtils.get_platform_id().value)
@@ -44,9 +40,7 @@ class RuntimeDependencyCollection:
def single_for_current_platform(self) -> RuntimeDependency:
deps = self.for_current_platform()
if len(deps) != 1:
raise RuntimeError(
f"Expected exactly one runtime dependency for {PlatformUtils.get_platform_id().value}, found {len(deps)}"
)
raise RuntimeError(f"Expected exactly one runtime dependency for {PlatformUtils.get_platform_id().value}, found {len(deps)}")
return deps[0]
def binary_path(self, target_dir: str) -> str:
@@ -55,13 +49,13 @@ class RuntimeDependencyCollection:
return target_dir
return os.path.join(target_dir, dep.binary_name)
def install(self, logger: LanguageServerLogger, target_dir: str) -> Dict[str, str]:
def install(self, logger: LanguageServerLogger, target_dir: str) -> dict[str, str]:
"""Install all dependencies for the current platform into *target_dir*.
Returns a mapping from dependency id to the resolved binary path.
"""
os.makedirs(target_dir, exist_ok=True)
results: Dict[str, str] = {}
results: dict[str, str] = {}
for dep in self.for_current_platform():
if dep.url:
self._install_from_url(dep, logger, target_dir)
@@ -16,8 +16,6 @@ import zipfile
from pathlib import Path
from typing import cast
from .common import RuntimeDependency
from overrides import override
from solidlsp.ls import SolidLanguageServer
@@ -28,6 +26,7 @@ from solidlsp.ls_utils import PathUtils
from solidlsp.lsp_protocol_handler.lsp_types import InitializeParams
from solidlsp.lsp_protocol_handler.server import ProcessLaunchInfo
from .common import RuntimeDependency
# Runtime dependencies configuration
RUNTIME_DEPENDENCIES = [
@@ -5,10 +5,10 @@ import stat
from solidlsp.ls import SolidLanguageServer
from solidlsp.ls_logger import LanguageServerLogger
from solidlsp.ls_utils import FileUtils, PlatformUtils
from .common import RuntimeDependency, RuntimeDependencyCollection
from solidlsp.lsp_protocol_handler.server import ProcessLaunchInfo
from .common import RuntimeDependency, RuntimeDependencyCollection
class DartLanguageServer(SolidLanguageServer):
"""
@@ -30,8 +30,6 @@ class DartLanguageServer(SolidLanguageServer):
@classmethod
def _setup_runtime_dependencies(cls, logger: "LanguageServerLogger") -> str:
platform_id = PlatformUtils.get_platform_id()
deps = RuntimeDependencyCollection(
[
RuntimeDependency(
@@ -6,7 +6,6 @@ import logging
import os
import pathlib
import shutil
import subprocess
from time import sleep
from overrides import override
@@ -15,10 +14,11 @@ from solidlsp.ls import SolidLanguageServer
from solidlsp.ls_config import LanguageServerConfig
from solidlsp.ls_logger import LanguageServerLogger
from solidlsp.ls_utils import PlatformId, PlatformUtils
from .common import RuntimeDependency, RuntimeDependencyCollection
from solidlsp.lsp_protocol_handler.lsp_types import DefinitionParams, InitializeParams
from solidlsp.lsp_protocol_handler.server import ProcessLaunchInfo
from .common import RuntimeDependency, RuntimeDependencyCollection
class Intelephense(SolidLanguageServer):
"""
@@ -13,11 +13,11 @@ from overrides import override
from solidlsp.ls import SolidLanguageServer
from solidlsp.ls_config import LanguageServerConfig
from solidlsp.ls_logger import LanguageServerLogger
from solidlsp.ls_utils import FileUtils, PlatformUtils
from .common import RuntimeDependency, RuntimeDependencyCollection
from solidlsp.lsp_protocol_handler.lsp_types import InitializeParams
from solidlsp.lsp_protocol_handler.server import ProcessLaunchInfo
from .common import RuntimeDependency, RuntimeDependencyCollection
class RustAnalyzer(SolidLanguageServer):
"""
@@ -50,8 +50,6 @@ class RustAnalyzer(SolidLanguageServer):
"""
Setup runtime dependencies for rust_analyzer and return the command to start the server.
"""
platform_id = PlatformUtils.get_platform_id()
deps = RuntimeDependencyCollection(
[
RuntimeDependency(
@@ -86,8 +84,6 @@ class RustAnalyzer(SolidLanguageServer):
# "win-x64",
# ], "Only linux-x64 and win-x64 platform is supported for in multilspy at the moment"
dependency = deps.single_for_current_platform()
rustanalyzer_ls_dir = os.path.join(cls.ls_resources_dir(), "RustAnalyzer")
rustanalyzer_executable_path = deps.binary_path(rustanalyzer_ls_dir)
if not os.path.exists(rustanalyzer_ls_dir):
@@ -9,11 +9,12 @@ from overrides import override
from solidlsp.ls import SolidLanguageServer
from solidlsp.ls_config import LanguageServerConfig
from solidlsp.ls_logger import LanguageServerLogger
from solidlsp.ls_utils import FileUtils, PathUtils, PlatformUtils
from .common import RuntimeDependency, RuntimeDependencyCollection
from solidlsp.ls_utils import PathUtils, PlatformUtils
from solidlsp.lsp_protocol_handler.lsp_types import InitializeParams
from solidlsp.lsp_protocol_handler.server import ProcessLaunchInfo
from .common import RuntimeDependency, RuntimeDependencyCollection
class TerraformLS(SolidLanguageServer):
"""
@@ -6,7 +6,6 @@ import logging
import os
import pathlib
import shutil
import subprocess
import threading
from time import sleep
@@ -16,10 +15,11 @@ from solidlsp.ls import SolidLanguageServer
from solidlsp.ls_config import LanguageServerConfig
from solidlsp.ls_logger import LanguageServerLogger
from solidlsp.ls_utils import PlatformId, PlatformUtils
from .common import RuntimeDependency, RuntimeDependencyCollection
from solidlsp.lsp_protocol_handler.lsp_types import InitializeParams
from solidlsp.lsp_protocol_handler.server import ProcessLaunchInfo
from .common import RuntimeDependency, RuntimeDependencyCollection
# Platform-specific imports
if os.name != "nt": # Unix-like systems
import pwd
@@ -33,7 +33,7 @@ else:
# Conditionally import pwd module (Unix-only)
if not PlatformUtils.get_platform_id().value.startswith("win"):
import pwd
pass
class TypeScriptLanguageServer(SolidLanguageServer):