anyenv 2.0.3__tar.gz → 2.0.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {anyenv-2.0.3 → anyenv-2.0.5}/PKG-INFO +1 -1
- {anyenv-2.0.3 → anyenv-2.0.5}/pyproject.toml +1 -1
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/lsp_servers/__init__.py +19 -1
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/lsp_servers/_base.py +1 -6
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/lsp_servers/_runner.py +64 -11
- anyenv-2.0.5/src/anyenv/lsp_servers/_servers/__init__.py +121 -0
- anyenv-2.0.5/src/anyenv/lsp_servers/_servers/c_lsps.py +28 -0
- anyenv-2.0.5/src/anyenv/lsp_servers/_servers/c_sharp_lsps.py +17 -0
- anyenv-2.0.5/src/anyenv/lsp_servers/_servers/dart_lsps.py +16 -0
- anyenv-2.0.5/src/anyenv/lsp_servers/_servers/elixir_lsps.py +14 -0
- anyenv-2.0.5/src/anyenv/lsp_servers/_servers/go_lsps.py +56 -0
- anyenv-2.0.5/src/anyenv/lsp_servers/_servers/java_lsps.py +22 -0
- anyenv-2.0.5/src/anyenv/lsp_servers/_servers/js_ts_lsps.py +286 -0
- anyenv-2.0.5/src/anyenv/lsp_servers/_servers/lua_lsps.py +30 -0
- anyenv-2.0.5/src/anyenv/lsp_servers/_servers/php_lsps.py +20 -0
- anyenv-2.0.5/src/anyenv/lsp_servers/_servers/python_lsps.py +423 -0
- anyenv-2.0.5/src/anyenv/lsp_servers/_servers/ruby_lsps.py +14 -0
- anyenv-2.0.5/src/anyenv/lsp_servers/_servers/rust_lsps.py +64 -0
- anyenv-2.0.5/src/anyenv/lsp_servers/_servers/swift_lsps.py +16 -0
- anyenv-2.0.5/src/anyenv/lsp_servers/_servers/yaml_lsps.py +26 -0
- anyenv-2.0.5/src/anyenv/lsp_servers/_servers/zig_lsps.py +19 -0
- anyenv-2.0.3/src/anyenv/lsp_servers/_servers.py +0 -658
- {anyenv-2.0.3 → anyenv-2.0.5}/LICENSE +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/README.md +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/__init__.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/anypath.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/as_generated.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/async_run.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/calling/__init__.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/calling/async_executor.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/calling/multieventhandler.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/calling/threadgroup.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/download/__init__.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/download/aiohttp_backend/__init__.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/download/aiohttp_backend/backend.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/download/base.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/download/exceptions.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/download/functional.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/download/http_types.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/download/httpx_backend/__init__.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/download/httpx_backend/backend.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/download/httpx_backend/js_transport.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/download/middleware.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/download/pyodide_backend/__init__.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/download/pyodide_backend/backend.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/helpers.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/json_tools/__init__.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/json_tools/base.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/json_tools/msgspec_provider/__init__.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/json_tools/msgspec_provider/provider.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/json_tools/orjson_provider/__init__.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/json_tools/orjson_provider/provider.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/json_tools/pydantic_provider/__init__.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/json_tools/pydantic_provider/provider.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/json_tools/stdlib_provider/__init__.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/json_tools/stdlib_provider/provider.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/json_tools/utils.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/language_formatters/__init__.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/language_formatters/_base.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/language_formatters/_elixir.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/language_formatters/_jvm.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/language_formatters/_python.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/language_formatters/_r.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/language_formatters/_registry.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/language_formatters/_ruby.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/language_formatters/_systems.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/language_formatters/_toml.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/language_formatters/_web.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/log.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/lsp_servers/_registry.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/os_commands/__init__.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/os_commands/base.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/os_commands/base64_encode.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/os_commands/copy_path.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/os_commands/create_directory.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/os_commands/env_var.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/os_commands/exists.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/os_commands/file_info.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/os_commands/find.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/os_commands/is_directory.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/os_commands/is_file.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/os_commands/list_directory.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/os_commands/models.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/os_commands/providers.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/os_commands/pwd.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/os_commands/remove_path.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/os_commands/which.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/package_install/__init__.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/package_install/base.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/package_install/functional.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/package_install/micropip_install.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/package_install/pip_install.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/parse_errors.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/parse_time.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/process_manager/__init__.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/process_manager/models.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/process_manager/process.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/process_manager/process_manager.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/process_manager/protocol.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/processes.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/py.typed +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/signals/__init__.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/signals/core.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/signals/examples.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/signals/review.md +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/task_runners/__init__.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/task_runners/_base.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/task_runners/_cargo.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/task_runners/_just.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/task_runners/_makefile.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/task_runners/_npm.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/task_runners/_python.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/task_runners/_task.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/testing.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/text_sharing/__init__.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/text_sharing/base.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/text_sharing/github_gist.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/text_sharing/opencode.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/text_sharing/paste_rs.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/text_sharing/pastebin.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/toml_tools/__init__.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/toml_tools/base.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/toml_tools/pytomlpp_provider/__init__.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/toml_tools/pytomlpp_provider/provider.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/toml_tools/rtoml_provider/__init__.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/toml_tools/rtoml_provider/provider.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/toml_tools/toml_rs_provider/__init__.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/toml_tools/toml_rs_provider/provider.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/toml_tools/tomllib_provider/__init__.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/toml_tools/tomllib_provider/provider.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.5}/src/anyenv/validate.py +0 -0
|
@@ -14,11 +14,17 @@ from anyenv.lsp_servers._base import (
|
|
|
14
14
|
RootDetection,
|
|
15
15
|
)
|
|
16
16
|
from anyenv.lsp_servers._registry import LSPServerRegistry
|
|
17
|
-
from anyenv.lsp_servers._runner import
|
|
17
|
+
from anyenv.lsp_servers._runner import (
|
|
18
|
+
CommandExecutor,
|
|
19
|
+
CommandResult,
|
|
20
|
+
DiagnosticRunner,
|
|
21
|
+
SimpleCommandResult,
|
|
22
|
+
)
|
|
18
23
|
from anyenv.lsp_servers._servers import (
|
|
19
24
|
ALL_SERVERS,
|
|
20
25
|
ASTRO,
|
|
21
26
|
BASEDPYRIGHT,
|
|
27
|
+
BIOME,
|
|
22
28
|
CLANGD,
|
|
23
29
|
CSHARP_LS,
|
|
24
30
|
DART,
|
|
@@ -29,16 +35,20 @@ from anyenv.lsp_servers._servers import (
|
|
|
29
35
|
JDTLS,
|
|
30
36
|
LUA_LS,
|
|
31
37
|
MYPY,
|
|
38
|
+
OXLINT,
|
|
32
39
|
PHP_INTELEPHENSE,
|
|
40
|
+
PYREFLY,
|
|
33
41
|
PYRIGHT,
|
|
34
42
|
RUBOCOP,
|
|
35
43
|
RUST_ANALYZER,
|
|
36
44
|
SOURCEKIT_LSP,
|
|
37
45
|
SVELTE,
|
|
46
|
+
TY,
|
|
38
47
|
TYPESCRIPT,
|
|
39
48
|
VUE,
|
|
40
49
|
YAML_LS,
|
|
41
50
|
ZLS,
|
|
51
|
+
ZUBAN,
|
|
42
52
|
# Custom server classes
|
|
43
53
|
AstroServer,
|
|
44
54
|
GoplsServer,
|
|
@@ -52,6 +62,7 @@ __all__ = [
|
|
|
52
62
|
"ALL_SERVERS",
|
|
53
63
|
"ASTRO",
|
|
54
64
|
"BASEDPYRIGHT",
|
|
65
|
+
"BIOME",
|
|
55
66
|
"CLANGD",
|
|
56
67
|
"CSHARP_LS",
|
|
57
68
|
"DART",
|
|
@@ -62,19 +73,25 @@ __all__ = [
|
|
|
62
73
|
"JDTLS",
|
|
63
74
|
"LUA_LS",
|
|
64
75
|
"MYPY",
|
|
76
|
+
"OXLINT",
|
|
65
77
|
"PHP_INTELEPHENSE",
|
|
78
|
+
"PYREFLY",
|
|
66
79
|
"PYRIGHT",
|
|
67
80
|
"RUBOCOP",
|
|
68
81
|
"RUST_ANALYZER",
|
|
69
82
|
"SOURCEKIT_LSP",
|
|
70
83
|
"SVELTE",
|
|
84
|
+
"TY",
|
|
71
85
|
"TYPESCRIPT",
|
|
72
86
|
"VUE",
|
|
73
87
|
"YAML_LS",
|
|
74
88
|
"ZLS",
|
|
89
|
+
"ZUBAN",
|
|
75
90
|
"AstroServer",
|
|
76
91
|
"CLIDiagnosticConfig",
|
|
77
92
|
"CargoInstall",
|
|
93
|
+
"CommandExecutor",
|
|
94
|
+
"CommandResult",
|
|
78
95
|
"Diagnostic",
|
|
79
96
|
"DiagnosticRunner",
|
|
80
97
|
"DiagnosticsResult",
|
|
@@ -90,5 +107,6 @@ __all__ = [
|
|
|
90
107
|
"PyrightServer",
|
|
91
108
|
"RootDetection",
|
|
92
109
|
"RustAnalyzerServer",
|
|
110
|
+
"SimpleCommandResult",
|
|
93
111
|
"TypeScriptServer",
|
|
94
112
|
]
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
from dataclasses import dataclass, field
|
|
6
|
+
import posixpath
|
|
6
7
|
from typing import TYPE_CHECKING, Any, Literal
|
|
7
8
|
|
|
8
9
|
|
|
@@ -158,16 +159,12 @@ class LSPServerInfo:
|
|
|
158
159
|
dotnet_install: DotnetInstall | None = None
|
|
159
160
|
gem_install: GemInstall | None = None
|
|
160
161
|
github_release: GitHubRelease | None = None
|
|
161
|
-
|
|
162
162
|
# LSP initialization settings (static)
|
|
163
163
|
initialization: dict[str, Any] = field(default_factory=dict)
|
|
164
|
-
|
|
165
164
|
# Environment variables
|
|
166
165
|
env: dict[str, str] = field(default_factory=dict)
|
|
167
|
-
|
|
168
166
|
# If True, single global instance (not per-project)
|
|
169
167
|
global_server: bool = False
|
|
170
|
-
|
|
171
168
|
# CLI diagnostic fallback
|
|
172
169
|
cli_diagnostics: CLIDiagnosticConfig | None = None
|
|
173
170
|
|
|
@@ -212,8 +209,6 @@ class LSPServerInfo:
|
|
|
212
209
|
Returns:
|
|
213
210
|
The resolved root directory, or None if this LSP shouldn't be used
|
|
214
211
|
"""
|
|
215
|
-
import posixpath
|
|
216
|
-
|
|
217
212
|
if self.root_detection.exclude_patterns:
|
|
218
213
|
excluded = await self._find_nearest(
|
|
219
214
|
posixpath.dirname(file_path),
|
|
@@ -1,33 +1,86 @@
|
|
|
1
|
-
"""Diagnostic runner
|
|
1
|
+
"""Diagnostic runner for LSP servers."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
+
import asyncio
|
|
6
|
+
from dataclasses import dataclass
|
|
5
7
|
import posixpath
|
|
6
|
-
|
|
8
|
+
import time
|
|
9
|
+
from typing import TYPE_CHECKING, Protocol
|
|
7
10
|
|
|
8
11
|
from anyenv.lsp_servers._base import DiagnosticsResult
|
|
9
12
|
|
|
10
13
|
|
|
11
14
|
if TYPE_CHECKING:
|
|
12
|
-
from exxec import ExecutionEnvironment
|
|
13
|
-
|
|
14
15
|
from anyenv.lsp_servers._base import Diagnostic, LSPServerInfo
|
|
15
16
|
|
|
16
17
|
|
|
18
|
+
class CommandResult(Protocol):
|
|
19
|
+
"""Protocol for command execution results."""
|
|
20
|
+
|
|
21
|
+
@property
|
|
22
|
+
def stdout(self) -> str | None: ...
|
|
23
|
+
|
|
24
|
+
@property
|
|
25
|
+
def stderr(self) -> str | None: ...
|
|
26
|
+
|
|
27
|
+
@property
|
|
28
|
+
def exit_code(self) -> int | None: ...
|
|
29
|
+
|
|
30
|
+
@property
|
|
31
|
+
def duration(self) -> float: ...
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
@dataclass
|
|
35
|
+
class SimpleCommandResult:
|
|
36
|
+
"""Simple implementation of CommandResult."""
|
|
37
|
+
|
|
38
|
+
stdout: str | None
|
|
39
|
+
stderr: str | None
|
|
40
|
+
exit_code: int | None
|
|
41
|
+
duration: float
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class CommandExecutor(Protocol):
|
|
45
|
+
"""Protocol for command execution."""
|
|
46
|
+
|
|
47
|
+
async def __call__(self, command: str) -> CommandResult:
|
|
48
|
+
"""Execute a command and return the result."""
|
|
49
|
+
...
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
async def _default_executor(command: str) -> SimpleCommandResult:
|
|
53
|
+
"""Default executor using asyncio subprocess."""
|
|
54
|
+
start = time.perf_counter()
|
|
55
|
+
proc = await asyncio.create_subprocess_shell(
|
|
56
|
+
command,
|
|
57
|
+
stdout=asyncio.subprocess.PIPE,
|
|
58
|
+
stderr=asyncio.subprocess.PIPE,
|
|
59
|
+
)
|
|
60
|
+
stdout, stderr = await proc.communicate()
|
|
61
|
+
duration = time.perf_counter() - start
|
|
62
|
+
return SimpleCommandResult(
|
|
63
|
+
stdout=stdout.decode() if stdout else "",
|
|
64
|
+
stderr=stderr.decode() if stderr else "",
|
|
65
|
+
exit_code=proc.returncode,
|
|
66
|
+
duration=duration,
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
|
|
17
70
|
class DiagnosticRunner:
|
|
18
|
-
"""Run diagnostics
|
|
71
|
+
"""Run diagnostics using CLI tools.
|
|
19
72
|
|
|
20
|
-
Works with any
|
|
73
|
+
Works with any command executor (local subprocess, Docker, SSH, etc.) to run
|
|
21
74
|
CLI diagnostic tools and parse their output.
|
|
22
75
|
"""
|
|
23
76
|
|
|
24
|
-
def __init__(self,
|
|
25
|
-
"""Initialize with an
|
|
77
|
+
def __init__(self, executor: CommandExecutor | None = None) -> None:
|
|
78
|
+
"""Initialize with an optional command executor.
|
|
26
79
|
|
|
27
80
|
Args:
|
|
28
|
-
|
|
81
|
+
executor: Callable to execute commands. Defaults to local subprocess.
|
|
29
82
|
"""
|
|
30
|
-
self.
|
|
83
|
+
self._executor = executor or _default_executor
|
|
31
84
|
self._servers: list[LSPServerInfo] = []
|
|
32
85
|
|
|
33
86
|
def register(self, server: LSPServerInfo) -> None:
|
|
@@ -74,7 +127,7 @@ class DiagnosticRunner:
|
|
|
74
127
|
return DiagnosticsResult(diagnostics=[], success=False, duration=0.0, error=msg)
|
|
75
128
|
|
|
76
129
|
command = server.build_diagnostic_command(files)
|
|
77
|
-
result = await self.
|
|
130
|
+
result = await self._executor(command)
|
|
78
131
|
diagnostics = server.parse_diagnostics(result.stdout or "", result.stderr or "")
|
|
79
132
|
# Parsing succeeded, even if there are errors
|
|
80
133
|
return DiagnosticsResult(diagnostics=diagnostics, success=True, duration=result.duration)
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"""LSP server definitions."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import TYPE_CHECKING
|
|
6
|
+
|
|
7
|
+
from .js_ts_lsps import (
|
|
8
|
+
DENO,
|
|
9
|
+
TYPESCRIPT,
|
|
10
|
+
VUE,
|
|
11
|
+
SVELTE,
|
|
12
|
+
ASTRO,
|
|
13
|
+
ESLINT,
|
|
14
|
+
OXLINT,
|
|
15
|
+
BIOME,
|
|
16
|
+
AstroServer,
|
|
17
|
+
TypeScriptServer,
|
|
18
|
+
)
|
|
19
|
+
from .python_lsps import TY, ZUBAN, PYREFLY, PYRIGHT, BASEDPYRIGHT, MYPY, PyrightServer, MypyServer
|
|
20
|
+
from .rust_lsps import RUST_ANALYZER, RustAnalyzerServer
|
|
21
|
+
from .go_lsps import GOPLS, GoplsServer
|
|
22
|
+
from .c_lsps import CLANGD
|
|
23
|
+
from .zig_lsps import ZLS
|
|
24
|
+
from .ruby_lsps import RUBOCOP
|
|
25
|
+
from .lua_lsps import LUA_LS
|
|
26
|
+
from .swift_lsps import SOURCEKIT_LSP
|
|
27
|
+
from .elixir_lsps import ELIXIR_LS
|
|
28
|
+
from .php_lsps import PHP_INTELEPHENSE
|
|
29
|
+
from .dart_lsps import DART
|
|
30
|
+
from .yaml_lsps import YAML_LS
|
|
31
|
+
from .c_sharp_lsps import CSHARP_LS
|
|
32
|
+
from .java_lsps import JDTLS
|
|
33
|
+
|
|
34
|
+
if TYPE_CHECKING:
|
|
35
|
+
from anyenv.lsp_servers._base import LSPServerInfo
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
__all__ = [
|
|
39
|
+
# Server instances
|
|
40
|
+
"ALL_SERVERS",
|
|
41
|
+
"ASTRO",
|
|
42
|
+
"BASEDPYRIGHT",
|
|
43
|
+
"BIOME",
|
|
44
|
+
"CLANGD",
|
|
45
|
+
"CSHARP_LS",
|
|
46
|
+
"DART",
|
|
47
|
+
"DENO",
|
|
48
|
+
"ELIXIR_LS",
|
|
49
|
+
"ESLINT",
|
|
50
|
+
"GOPLS",
|
|
51
|
+
"JDTLS",
|
|
52
|
+
"LUA_LS",
|
|
53
|
+
"MYPY",
|
|
54
|
+
"OXLINT",
|
|
55
|
+
"PHP_INTELEPHENSE",
|
|
56
|
+
"PYREFLY",
|
|
57
|
+
"PYRIGHT",
|
|
58
|
+
"RUBOCOP",
|
|
59
|
+
"RUST_ANALYZER",
|
|
60
|
+
"SOURCEKIT_LSP",
|
|
61
|
+
"SVELTE",
|
|
62
|
+
"TY",
|
|
63
|
+
"TYPESCRIPT",
|
|
64
|
+
"VUE",
|
|
65
|
+
"YAML_LS",
|
|
66
|
+
"ZLS",
|
|
67
|
+
"ZUBAN",
|
|
68
|
+
# Server classes
|
|
69
|
+
"AstroServer",
|
|
70
|
+
"GoplsServer",
|
|
71
|
+
"MypyServer",
|
|
72
|
+
"PyrightServer",
|
|
73
|
+
"RustAnalyzerServer",
|
|
74
|
+
"TypeScriptServer",
|
|
75
|
+
]
|
|
76
|
+
|
|
77
|
+
# All servers
|
|
78
|
+
ALL_SERVERS: list[LSPServerInfo] = [
|
|
79
|
+
# JavaScript/TypeScript
|
|
80
|
+
OXLINT,
|
|
81
|
+
BIOME,
|
|
82
|
+
DENO,
|
|
83
|
+
TYPESCRIPT,
|
|
84
|
+
VUE,
|
|
85
|
+
SVELTE,
|
|
86
|
+
ASTRO,
|
|
87
|
+
ESLINT,
|
|
88
|
+
# Python
|
|
89
|
+
TY,
|
|
90
|
+
ZUBAN,
|
|
91
|
+
PYREFLY,
|
|
92
|
+
PYRIGHT,
|
|
93
|
+
BASEDPYRIGHT,
|
|
94
|
+
MYPY,
|
|
95
|
+
# Go
|
|
96
|
+
GOPLS,
|
|
97
|
+
# Rust
|
|
98
|
+
RUST_ANALYZER,
|
|
99
|
+
# Zig
|
|
100
|
+
ZLS,
|
|
101
|
+
# C/C++
|
|
102
|
+
CLANGD,
|
|
103
|
+
# C#
|
|
104
|
+
CSHARP_LS,
|
|
105
|
+
# Ruby
|
|
106
|
+
RUBOCOP,
|
|
107
|
+
# Elixir
|
|
108
|
+
ELIXIR_LS,
|
|
109
|
+
# Swift
|
|
110
|
+
SOURCEKIT_LSP,
|
|
111
|
+
# Java
|
|
112
|
+
JDTLS,
|
|
113
|
+
# YAML
|
|
114
|
+
YAML_LS,
|
|
115
|
+
# Lua
|
|
116
|
+
LUA_LS,
|
|
117
|
+
# PHP
|
|
118
|
+
PHP_INTELEPHENSE,
|
|
119
|
+
# Dart
|
|
120
|
+
DART,
|
|
121
|
+
]
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"""LSP server definitions for C / C++."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from anyenv.lsp_servers._base import GitHubRelease, LSPServerInfo, RootDetection
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
CLANGD = LSPServerInfo(
|
|
9
|
+
id="clangd",
|
|
10
|
+
extensions=[".c", ".cpp", ".cc", ".cxx", ".c++", ".h", ".hpp", ".hh", ".hxx", ".h++"],
|
|
11
|
+
root_detection=RootDetection(
|
|
12
|
+
include_patterns=[
|
|
13
|
+
"compile_commands.json",
|
|
14
|
+
"compile_flags.txt",
|
|
15
|
+
".clangd",
|
|
16
|
+
"CMakeLists.txt",
|
|
17
|
+
"Makefile",
|
|
18
|
+
],
|
|
19
|
+
),
|
|
20
|
+
command="clangd",
|
|
21
|
+
args=["--background-index", "--clang-tidy"],
|
|
22
|
+
github_release=GitHubRelease(
|
|
23
|
+
repo="clangd/clangd",
|
|
24
|
+
asset_pattern="clangd-{platform}-{version}.{ext}",
|
|
25
|
+
binary_name="clangd",
|
|
26
|
+
extract_subdir="clangd_{version}/bin",
|
|
27
|
+
),
|
|
28
|
+
)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"""LSP server definitions for C#."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from anyenv.lsp_servers._base import DotnetInstall, LSPServerInfo, RootDetection
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
CSHARP_LS = LSPServerInfo(
|
|
9
|
+
id="csharp-ls",
|
|
10
|
+
extensions=[".cs"],
|
|
11
|
+
root_detection=RootDetection(
|
|
12
|
+
include_patterns=[".sln", ".csproj", "global.json"],
|
|
13
|
+
),
|
|
14
|
+
command="csharp-ls",
|
|
15
|
+
args=[],
|
|
16
|
+
dotnet_install=DotnetInstall(package="csharp-ls"),
|
|
17
|
+
)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"""LSP server definitions for Dart."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from anyenv.lsp_servers._base import LSPServerInfo, RootDetection
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
DART = LSPServerInfo(
|
|
9
|
+
id="dart",
|
|
10
|
+
extensions=[".dart"],
|
|
11
|
+
root_detection=RootDetection(
|
|
12
|
+
include_patterns=["pubspec.yaml", "analysis_options.yaml"],
|
|
13
|
+
),
|
|
14
|
+
command="dart",
|
|
15
|
+
args=["language-server", "--lsp"],
|
|
16
|
+
)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"""LSP server definitions for various languages."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from anyenv.lsp_servers._base import LSPServerInfo, RootDetection
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
ELIXIR_LS = LSPServerInfo(
|
|
9
|
+
id="elixir-ls",
|
|
10
|
+
extensions=[".ex", ".exs"],
|
|
11
|
+
root_detection=RootDetection(include_patterns=["mix.exs", "mix.lock"]),
|
|
12
|
+
command="elixir-ls",
|
|
13
|
+
args=[],
|
|
14
|
+
)
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"""LSP server definitions for various languages."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from dataclasses import dataclass
|
|
6
|
+
import posixpath
|
|
7
|
+
from typing import TYPE_CHECKING
|
|
8
|
+
|
|
9
|
+
from anyenv.lsp_servers._base import GoInstall, LSPServerInfo, RootDetection
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
if TYPE_CHECKING:
|
|
13
|
+
from fsspec.asyn import AsyncFileSystem # type: ignore[import-untyped]
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@dataclass
|
|
17
|
+
class GoplsServer(LSPServerInfo):
|
|
18
|
+
"""Go language server with go.work priority."""
|
|
19
|
+
|
|
20
|
+
async def resolve_root(
|
|
21
|
+
self,
|
|
22
|
+
file_path: str,
|
|
23
|
+
project_root: str,
|
|
24
|
+
fs: AsyncFileSystem,
|
|
25
|
+
) -> str | None:
|
|
26
|
+
"""Prefer go.work over go.mod for workspace support."""
|
|
27
|
+
# First check for go.work
|
|
28
|
+
work_root = await self._find_nearest(
|
|
29
|
+
posixpath.dirname(file_path),
|
|
30
|
+
["go.work"],
|
|
31
|
+
project_root,
|
|
32
|
+
fs,
|
|
33
|
+
)
|
|
34
|
+
if work_root:
|
|
35
|
+
return posixpath.dirname(work_root)
|
|
36
|
+
|
|
37
|
+
# Fall back to go.mod
|
|
38
|
+
mod_root = await self._find_nearest(
|
|
39
|
+
posixpath.dirname(file_path),
|
|
40
|
+
["go.mod", "go.sum"],
|
|
41
|
+
project_root,
|
|
42
|
+
fs,
|
|
43
|
+
)
|
|
44
|
+
return posixpath.dirname(mod_root) if mod_root else project_root
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
GOPLS = GoplsServer(
|
|
48
|
+
id="gopls",
|
|
49
|
+
extensions=[".go"],
|
|
50
|
+
root_detection=RootDetection(
|
|
51
|
+
include_patterns=["go.work", "go.mod", "go.sum"],
|
|
52
|
+
),
|
|
53
|
+
command="gopls",
|
|
54
|
+
args=[],
|
|
55
|
+
go_install=GoInstall(package="golang.org/x/tools/gopls@latest"),
|
|
56
|
+
)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"""LSP server definitions for Java."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from anyenv.lsp_servers._base import LSPServerInfo, RootDetection
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
JDTLS = LSPServerInfo(
|
|
9
|
+
id="jdtls",
|
|
10
|
+
extensions=[".java"],
|
|
11
|
+
root_detection=RootDetection(
|
|
12
|
+
include_patterns=[
|
|
13
|
+
"pom.xml",
|
|
14
|
+
"build.gradle",
|
|
15
|
+
"build.gradle.kts",
|
|
16
|
+
".project",
|
|
17
|
+
".classpath",
|
|
18
|
+
],
|
|
19
|
+
),
|
|
20
|
+
command="jdtls",
|
|
21
|
+
args=[],
|
|
22
|
+
)
|