DependencyProviders: Allow only lists for commands to ensure robustness

This commit is contained in:
Dominik Jain authored and Dominik Jain committed 2026-02-13 03:20:13 +01:00
1 parent cd2f6f6717
commit 256cb61416
9 files changed
+14 -16

No files matched your search

@@ -90,7 +90,7 @@ class BashLanguageServer(SolidLanguageServer):
return bash_executable_path
def _create_launch_command(self, core_path: str) -> list[str] | str:
def _create_launch_command(self, core_path: str) -> list[str]:
return [core_path, "start"]
@staticmethod
@@ -91,7 +91,7 @@ class CCLS(SolidLanguageServer):
log.info(f"Using system-installed ccls at {ccls_path}")
return ccls_path
def _create_launch_command(self, core_path: str) -> list[str] | str:
def _create_launch_command(self, core_path: str) -> list[str]:
return [core_path]
@staticmethod
+1 -1
View File
@@ -123,7 +123,7 @@ class ClojureLSP(SolidLanguageServer):
os.chmod(clojurelsp_executable_path, 0o755)
return clojurelsp_executable_path
def _create_launch_command(self, core_path: str) -> list[str] | str:
def _create_launch_command(self, core_path: str) -> list[str]:
return [core_path]
@staticmethod
@@ -306,7 +306,7 @@ class CSharpLanguageServer(SolidLanguageServer):
self._repository_root_path = repository_root_path
self._dotnet_path, self._language_server_path = self._ensure_server_installed()
def create_launch_command(self) -> list[str] | str:
def create_launch_command(self) -> list[str]:
# Find solution or project file
solution_or_project = find_solution_or_project_file(self._repository_root_path)
@@ -271,7 +271,7 @@ class EclipseJDTLS(SolidLanguageServer):
intellisense_members_path=intellisense_members_path,
)
def create_launch_command(self) -> list[str] | str:
def create_launch_command(self) -> list[str]:
# ws_dir is the workspace directory for the EclipseJDTLS server
ws_dir = str(
PurePath(
@@ -38,7 +38,7 @@ import platform
import shutil
import threading
import zipfile
from typing import Any, Union, cast
from typing import Any, cast
import requests
@@ -339,7 +339,7 @@ class MatlabLanguageServer(SolidLanguageServer):
self._matlab_path = matlab_path
return matlab_path
def create_launch_command(self) -> Union[str, list[str]]:
def create_launch_command(self) -> list[str]:
# Verify node is installed
node_path = shutil.which("node")
if node_path is None:
@@ -165,7 +165,7 @@ class RustAnalyzer(SolidLanguageServer):
def _get_or_install_core_dependency(self) -> str:
return self._ensure_rust_analyzer_installed()
def _create_launch_command(self, core_path: str) -> list[str] | str:
def _create_launch_command(self, core_path: str) -> list[str]:
return [core_path]
def __init__(self, config: LanguageServerConfig, repository_root_path: str, solidlsp_settings: SolidLSPSettings):
@@ -163,7 +163,7 @@ class TaploServer(SolidLanguageServer):
return taplo_executable
def _create_launch_command(self, core_path: str) -> list[str] | str:
def _create_launch_command(self, core_path: str) -> list[str]:
return [core_path, "lsp", "stdio"]
@classmethod
+5 -7
View File
@@ -241,13 +241,12 @@ class LanguageServerDependencyProvider(ABC):
self._ls_resources_dir = ls_resources_dir
@abstractmethod
def create_launch_command(self) -> list[str] | str:
def create_launch_command(self) -> list[str]:
"""
Creates the launch command for this language server, potentially downloading and installing dependencies
beforehand.
:return: the launch command as a list containing the executable and its arguments (preferred for robustness)
or the entire command in a single string.
:return: the launch command as a list containing the executable and its arguments
"""
def create_launch_command_env(self) -> dict[str, str]:
@@ -279,7 +278,7 @@ class LanguageServerDependencyProviderSinglePath(LanguageServerDependencyProvide
:return: the core dependency's path (e.g. executable, jar, etc.)
"""
def create_launch_command(self) -> Union[str, list[str]]:
def create_launch_command(self) -> list[str]:
path = self._custom_settings.get("ls_path", None)
if path is not None:
core_path = path
@@ -288,11 +287,10 @@ class LanguageServerDependencyProviderSinglePath(LanguageServerDependencyProvide
return self._create_launch_command(core_path)
@abstractmethod
def _create_launch_command(self, core_path: str) -> list[str] | str:
def _create_launch_command(self, core_path: str) -> list[str]:
"""
:param core_path: path to the core dependency
:return: the launch command as a list containing the executable and its arguments (preferred for robustness)
or the entire command in a single string.
:return: the launch command as a list containing the executable and its arguments
"""