Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/solidlsp/language_servers/rust_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,13 @@ def _create_dependency_provider(self) -> LanguageServerDependencyProvider:
def is_ignored_dirname(self, dirname: str) -> bool:
return super().is_ignored_dirname(dirname) or dirname in ["target"]

@override
def _get_published_diagnostics_wait_timeout(self, pull_diagnostics_failed: bool) -> float:
timeout = super()._get_published_diagnostics_wait_timeout(pull_diagnostics_failed)
# Rust diagnostics are often published asynchronously after the pull-diagnostics request,
# so keep a wider fallback wait window across all platforms.
return max(timeout, 8.0)

@staticmethod
def _get_initialize_params(repository_absolute_path: str) -> InitializeParams:
"""
Expand Down
14 changes: 14 additions & 0 deletions test/solidlsp/rust/test_rust_analyzer_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,20 @@ def test_auto_install_success_but_binary_not_found_falls_through(self):
assert "searched locations" in error_message.lower() # Should show what was checked


class TestRustAnalyzerDiagnosticsTimeout:
@pytest.mark.rust
@pytest.mark.parametrize("os_name", ["Windows", "Linux"])
def test_all_platforms_use_longer_diagnostics_wait_timeout(self, os_name: str):
from solidlsp.language_servers.rust_analyzer import RustAnalyzer

analyzer = RustAnalyzer.__new__(RustAnalyzer)

with patch("solidlsp.language_servers.rust_analyzer.platform.system", return_value=os_name):
timeout = analyzer._get_published_diagnostics_wait_timeout(False)

assert timeout >= 8.0


class TestRustAnalyzerDetectionIntegration:
"""
Integration tests that verify detection works on the current system.
Expand Down
Loading