fix: drop restartOnCrash + maxRestarts (loader rejects them) — 0.1.1 - #3
Conversation
The Claude Code 2.1.x runtime documents `restartOnCrash` and `maxRestarts` in the plugins reference but rejects them at LSP server init with: "restartOnCrash is not yet implemented. Remove this field from the configuration." With these fields in `.lsp.json` (or in the marketplace.json `lspServers` block), the entire LSP server is rejected — `claude --debug` shows `Failed to initialize LSP server plugin:zig-lsp:zig` and `.zig` files get `No LSP server available`. Without them, ZLS spawns, didOpen succeeds, publishDiagnostics flows, and documentSymbol / hover return real results. Verified end-to-end against a Zig 0.17 project (cockpit/.../agent-probe-zig). Bumps to 0.1.1. Files: - plugins/zig-lsp/.lsp.json: drop restartOnCrash + maxRestarts; keep startupTimeout - .claude-plugin/marketplace.json: same in lspServers block; bump zig-lsp entry version 0.1.0 -> 0.1.1 - plugins/zig-lsp/.claude-plugin/plugin.json: version 0.1.0 -> 0.1.1 - plugins/zig-lsp/README.md: defaults table no longer lists those fields; gotchas note that a crashed ZLS stays dead until session restart (since no auto-restart available) - CLAUDE.md / AGENTS.md / CONTRIBUTING.md: plug-shape rules forbid restartOnCrash / maxRestarts until runtime ships them - agent-knowledge/claude-code-lsp-plugin-contribution.md: empirical evidence row added; corrected key facts now also note `lspServers` inline in plugin.json works as a third config path (verified by user's local edit + michelsciortino/dart-lsp) - CHANGELOG.md: 0.1.1 entry merging the prior Unreleased work
There was a problem hiding this comment.
Code Review
This pull request updates the zig-lsp plugin to version 0.1.1, primarily to remove the restartOnCrash and maxRestarts configuration fields which were found to cause initialization failures in Claude Code v2.1.119. Documentation across several files has been revised to reflect these findings and clarify the necessary plugin structure for third-party LSP servers. Feedback was provided regarding the CHANGELOG.md to ensure historical accuracy by retaining the original description of the 0.1.0 release.
| - Initial `zig-lsp` plugin for Claude Code, dispatching to user-installed `zls` | ||
| - `agent-sh` marketplace shell hosting `zig-lsp` (and ready for future LSP plugins) | ||
| - `.lsp.json` mapping `.zig` and `.zon` to language ID `zig`, with `enable_build_on_save`, `restartOnCrash`, and a 30 s startup timeout | ||
| - `.lsp.json` mapping `.zig` and `.zon` to language ID `zig`, with `enable_build_on_save` and a 30 s startup timeout |
There was a problem hiding this comment.
Retroactively modifying the 0.1.0 entry to remove restartOnCrash makes the changelog historically inaccurate, as that version did include those fields in its manifest. It is generally better to keep historical entries as they were released and document the removal in the current version's section.
| - `.lsp.json` mapping `.zig` and `.zon` to language ID `zig`, with `enable_build_on_save` and a 30 s startup timeout | |
| - .lsp.json mapping .zig and .zon to language ID zig, with enable_build_on_save, restartOnCrash, and a 30 s startup timeout |
Summary
Claude Code 2.1.x runtime documents
restartOnCrashandmaxRestartsin the plugins reference, but the LSP loader rejects them at init time:```
[ERROR] Failed to initialize LSP server plugin:zig-lsp:zig: LSP server 'plugin:zig-lsp:zig': restartOnCrash is not yet implemented. Remove this field from the configuration.
```
When these fields are present, the entire LSP server is rejected (not just the field) —
.zigfiles get `No LSP server available`. Removing them makes ZLS spawn cleanly anddocumentSymbol/hover/ post-edit diagnostics work. `startupTimeout` is fine; only the lifecycle-restart fields are unimplemented.Empirical verification
Tested end-to-end against `cockpit/src-tauri/sidecars/agent-probe-zig` (Zig 0.17, ~900 LOC):
Failed to initialize LSP serverLoaded 1 LSP server(s) from plugin: zig-lspLSP documentSymbolonmain.zigNo LSP server available for file type .zigLSP hoveronSessionstructpublishDiagnosticsChanges
plugins/zig-lsp/.lsp.jsonrestartOnCrash,maxRestarts; keepstartupTimeout: 30000.claude-plugin/marketplace.jsonlspServersblock; bump entryversion0.1.0 → 0.1.1plugins/zig-lsp/.claude-plugin/plugin.jsonplugins/zig-lsp/README.mdCLAUDE.md/AGENTS.md/CONTRIBUTING.mdagent-knowledge/claude-code-lsp-plugin-contribution.mdCHANGELOG.md.lsp.json-restore workTest plan
claude plugin validate .passesclaude plugin validate plugins/zig-lsppassesagnix --target claude-codepasses (0 errors)LSPoperations return real results oncockpit/.../agent-probe-zig/plugin marketplace update agent-sh && /plugin uninstall zig-lsp@agent-sh && /plugin install zig-lsp@agent-shproduces a clean install with the LSP working from a fresh cacheNote
Medium Risk
Updates shipped LSP manifests and marketplace metadata; while the change is small, any manifest/schema mistake could prevent
zig-lspfrom loading and break Zig LSP for users.Overview
Releases
zig-lspv0.1.1 and fixes initialization on Claude Code 2.1.x by removing the unsupportedrestartOnCrash/maxRestartsfields from bothplugins/zig-lsp/.lsp.jsonand the marketplacelspServersentry (keepingstartupTimeout).Updates contributor/user docs and the changelog to reflect the corrected third-party LSP plugin shape and explicitly forbid these fields until the loader implements them, plus adjusts the README to note that crashed ZLS won’t auto-restart.
Reviewed by Cursor Bugbot for commit e6ffad6. Configure here.