anyenv 2.0.3__tar.gz → 2.0.4__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.4}/PKG-INFO +1 -1
- {anyenv-2.0.3 → anyenv-2.0.4}/pyproject.toml +1 -1
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/lsp_servers/__init__.py +9 -1
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/lsp_servers/_base.py +1 -6
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/lsp_servers/_runner.py +64 -11
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/lsp_servers/_servers.py +16 -17
- {anyenv-2.0.3 → anyenv-2.0.4}/LICENSE +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/README.md +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/__init__.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/anypath.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/as_generated.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/async_run.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/calling/__init__.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/calling/async_executor.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/calling/multieventhandler.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/calling/threadgroup.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/download/__init__.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/download/aiohttp_backend/__init__.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/download/aiohttp_backend/backend.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/download/base.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/download/exceptions.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/download/functional.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/download/http_types.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/download/httpx_backend/__init__.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/download/httpx_backend/backend.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/download/httpx_backend/js_transport.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/download/middleware.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/download/pyodide_backend/__init__.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/download/pyodide_backend/backend.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/helpers.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/json_tools/__init__.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/json_tools/base.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/json_tools/msgspec_provider/__init__.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/json_tools/msgspec_provider/provider.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/json_tools/orjson_provider/__init__.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/json_tools/orjson_provider/provider.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/json_tools/pydantic_provider/__init__.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/json_tools/pydantic_provider/provider.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/json_tools/stdlib_provider/__init__.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/json_tools/stdlib_provider/provider.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/json_tools/utils.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/language_formatters/__init__.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/language_formatters/_base.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/language_formatters/_elixir.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/language_formatters/_jvm.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/language_formatters/_python.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/language_formatters/_r.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/language_formatters/_registry.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/language_formatters/_ruby.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/language_formatters/_systems.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/language_formatters/_toml.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/language_formatters/_web.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/log.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/lsp_servers/_registry.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/os_commands/__init__.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/os_commands/base.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/os_commands/base64_encode.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/os_commands/copy_path.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/os_commands/create_directory.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/os_commands/env_var.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/os_commands/exists.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/os_commands/file_info.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/os_commands/find.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/os_commands/is_directory.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/os_commands/is_file.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/os_commands/list_directory.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/os_commands/models.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/os_commands/providers.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/os_commands/pwd.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/os_commands/remove_path.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/os_commands/which.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/package_install/__init__.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/package_install/base.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/package_install/functional.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/package_install/micropip_install.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/package_install/pip_install.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/parse_errors.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/parse_time.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/process_manager/__init__.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/process_manager/models.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/process_manager/process.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/process_manager/process_manager.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/process_manager/protocol.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/processes.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/py.typed +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/signals/__init__.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/signals/core.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/signals/examples.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/signals/review.md +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/task_runners/__init__.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/task_runners/_base.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/task_runners/_cargo.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/task_runners/_just.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/task_runners/_makefile.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/task_runners/_npm.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/task_runners/_python.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/task_runners/_task.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/testing.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/text_sharing/__init__.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/text_sharing/base.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/text_sharing/github_gist.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/text_sharing/opencode.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/text_sharing/paste_rs.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/text_sharing/pastebin.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/toml_tools/__init__.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/toml_tools/base.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/toml_tools/pytomlpp_provider/__init__.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/toml_tools/pytomlpp_provider/provider.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/toml_tools/rtoml_provider/__init__.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/toml_tools/rtoml_provider/provider.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/toml_tools/toml_rs_provider/__init__.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/toml_tools/toml_rs_provider/provider.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/toml_tools/tomllib_provider/__init__.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/toml_tools/tomllib_provider/provider.py +0 -0
- {anyenv-2.0.3 → anyenv-2.0.4}/src/anyenv/validate.py +0 -0
|
@@ -14,7 +14,12 @@ 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,
|
|
@@ -75,6 +80,8 @@ __all__ = [
|
|
|
75
80
|
"AstroServer",
|
|
76
81
|
"CLIDiagnosticConfig",
|
|
77
82
|
"CargoInstall",
|
|
83
|
+
"CommandExecutor",
|
|
84
|
+
"CommandResult",
|
|
78
85
|
"Diagnostic",
|
|
79
86
|
"DiagnosticRunner",
|
|
80
87
|
"DiagnosticsResult",
|
|
@@ -90,5 +97,6 @@ __all__ = [
|
|
|
90
97
|
"PyrightServer",
|
|
91
98
|
"RootDetection",
|
|
92
99
|
"RustAnalyzerServer",
|
|
100
|
+
"SimpleCommandResult",
|
|
93
101
|
"TypeScriptServer",
|
|
94
102
|
]
|
|
@@ -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)
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
from dataclasses import dataclass
|
|
6
|
-
import json
|
|
7
6
|
import os
|
|
8
7
|
import posixpath
|
|
9
8
|
from typing import TYPE_CHECKING, Any
|
|
@@ -26,6 +25,13 @@ from anyenv.lsp_servers._base import (
|
|
|
26
25
|
|
|
27
26
|
|
|
28
27
|
# Custom server classes for complex behaviors
|
|
28
|
+
def get_python_venv_candidates(root: str) -> list[str]:
|
|
29
|
+
paths = [
|
|
30
|
+
os.environ.get("VIRTUAL_ENV"),
|
|
31
|
+
posixpath.join(root, ".venv"),
|
|
32
|
+
posixpath.join(root, "venv"),
|
|
33
|
+
]
|
|
34
|
+
return [i for i in paths if i is not None]
|
|
29
35
|
|
|
30
36
|
|
|
31
37
|
@dataclass
|
|
@@ -75,15 +81,7 @@ class PyrightServer(LSPServerInfo):
|
|
|
75
81
|
"""Detect virtualenv and set pythonPath."""
|
|
76
82
|
init = await super().resolve_initialization(root, fs)
|
|
77
83
|
|
|
78
|
-
|
|
79
|
-
os.environ.get("VIRTUAL_ENV"),
|
|
80
|
-
posixpath.join(root, ".venv"),
|
|
81
|
-
posixpath.join(root, "venv"),
|
|
82
|
-
]
|
|
83
|
-
|
|
84
|
-
for venv_path in venv_candidates:
|
|
85
|
-
if venv_path is None:
|
|
86
|
-
continue
|
|
84
|
+
for venv_path in get_python_venv_candidates(root):
|
|
87
85
|
if os.name == "nt":
|
|
88
86
|
python = posixpath.join(venv_path, "Scripts", "python.exe")
|
|
89
87
|
else:
|
|
@@ -99,6 +97,8 @@ class PyrightServer(LSPServerInfo):
|
|
|
99
97
|
|
|
100
98
|
def _parse_json_diagnostics(self, output: str) -> list[Diagnostic]:
|
|
101
99
|
"""Parse pyright JSON output."""
|
|
100
|
+
import anyenv
|
|
101
|
+
|
|
102
102
|
diagnostics: list[Diagnostic] = []
|
|
103
103
|
|
|
104
104
|
try:
|
|
@@ -106,7 +106,7 @@ class PyrightServer(LSPServerInfo):
|
|
|
106
106
|
json_start = output.find("{")
|
|
107
107
|
if json_start == -1:
|
|
108
108
|
return diagnostics
|
|
109
|
-
data =
|
|
109
|
+
data = anyenv.load_json(output[json_start:], return_type=dict)
|
|
110
110
|
|
|
111
111
|
for diag in data.get("generalDiagnostics", []):
|
|
112
112
|
range_info = diag.get("range", {})
|
|
@@ -126,7 +126,7 @@ class PyrightServer(LSPServerInfo):
|
|
|
126
126
|
source=self.id,
|
|
127
127
|
)
|
|
128
128
|
)
|
|
129
|
-
except
|
|
129
|
+
except anyenv.JsonLoadError:
|
|
130
130
|
pass
|
|
131
131
|
|
|
132
132
|
return diagnostics
|
|
@@ -138,14 +138,15 @@ class MypyServer(LSPServerInfo):
|
|
|
138
138
|
|
|
139
139
|
def _parse_json_diagnostics(self, output: str) -> list[Diagnostic]:
|
|
140
140
|
"""Parse mypy JSON output (one JSON object per line)."""
|
|
141
|
-
|
|
141
|
+
import anyenv
|
|
142
142
|
|
|
143
|
+
diagnostics: list[Diagnostic] = []
|
|
143
144
|
for line in output.strip().splitlines():
|
|
144
145
|
line = line.strip()
|
|
145
146
|
if not line or not line.startswith("{"):
|
|
146
147
|
continue
|
|
147
148
|
try:
|
|
148
|
-
data =
|
|
149
|
+
data = anyenv.load_json(line, return_type=dict)
|
|
149
150
|
diagnostics.append(
|
|
150
151
|
Diagnostic(
|
|
151
152
|
file=data.get("file", ""),
|
|
@@ -157,7 +158,7 @@ class MypyServer(LSPServerInfo):
|
|
|
157
158
|
source=self.id,
|
|
158
159
|
)
|
|
159
160
|
)
|
|
160
|
-
except
|
|
161
|
+
except anyenv.JsonLoadError:
|
|
161
162
|
continue
|
|
162
163
|
|
|
163
164
|
return diagnostics
|
|
@@ -170,7 +171,6 @@ class TypeScriptServer(LSPServerInfo):
|
|
|
170
171
|
async def resolve_initialization(self, root: str, fs: AsyncFileSystem) -> dict[str, Any]:
|
|
171
172
|
"""Detect tsserver.js path."""
|
|
172
173
|
init = await super().resolve_initialization(root, fs)
|
|
173
|
-
|
|
174
174
|
tsserver = posixpath.join(root, "node_modules", "typescript", "lib", "tsserver.js")
|
|
175
175
|
try:
|
|
176
176
|
if await fs._exists(tsserver): # noqa: SLF001
|
|
@@ -188,7 +188,6 @@ class AstroServer(LSPServerInfo):
|
|
|
188
188
|
async def resolve_initialization(self, root: str, fs: AsyncFileSystem) -> dict[str, Any]:
|
|
189
189
|
"""Detect TypeScript SDK path for Astro."""
|
|
190
190
|
init = await super().resolve_initialization(root, fs)
|
|
191
|
-
|
|
192
191
|
tsserver = posixpath.join(root, "node_modules", "typescript", "lib", "tsserver.js")
|
|
193
192
|
try:
|
|
194
193
|
if await fs._exists(tsserver): # noqa: SLF001
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|