Skip to content

Commit b58c55f

Browse files
committed
fix(nix): use published diagnostics for nixd
1 parent e6b3852 commit b58c55f

3 files changed

Lines changed: 9 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ Status of the `main` branch. Changes prior to the next official version change w
3535
project creation)
3636
- Add `python_basedpyright` as an alternative Python language server
3737
- Nix/nixd: support custom `ls_path` launchers and external JSON settings through `config_path` #1737
38+
- Fix: Nix/nixd diagnostics now use published diagnostics instead of the unsupported
39+
`textDocument/diagnostic` request, which terminated nixd #1802
3840
- Fix: `get_diagnostics_for_file` crashed with `SolidLSPException` for any Ansible file with at least
3941
one lint finding, because `ansible-language-server` doesn't implement `textDocument/documentSymbol`
4042
and the request used to map diagnostics onto owning symbols just threw. `AnsibleLanguageServer` now

src/solidlsp/language_servers/nixd_ls.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,12 @@ def _create_base_initialize_params(self) -> dict:
378378
}
379379
return initialize_params
380380

381+
@override
382+
def _supports_pull_diagnostics(self) -> bool:
383+
# nixd publishes diagnostics after textDocument/didOpen but terminates when it receives
384+
# textDocument/diagnostic. Force the published-diagnostics path instead.
385+
return False
386+
381387
def _start_server(self):
382388
"""Start nixd server process"""
383389
initialize_params = self._create_initialize_params()

test/solidlsp/nix/test_nix_basic.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,3 +259,4 @@ def test_file_diagnostics(self, language_server: SolidLanguageServer) -> None:
259259
(),
260260
min_count=1,
261261
)
262+
assert language_server.is_running()

0 commit comments

Comments
 (0)