Repository navigation
Restart the language server on config changes after a failed start - #2257
Conversation
commit: |
webpro
left a comment
There was a problem hiding this comment.
Thanks for the pull request! The premise checks out over the real server: after a failed start, base ignores every file change until a manual restart, and this branch starts again on the next config change. Tracking the failed start's revision is the right shape: falling through the early return would also start after knip.stop and before a deferred first start, and the monotonic revision needs no resets. The lifecycle tests fail without the change for the intended reason.
Optional: a test for a source-only change after a failed start (one createOptions call, one logged error) would pin the !session guard in handleFileChanges, which no current test catches when removed.
webpro
left a comment
There was a problem hiding this comment.
Approved at the new head: the added lifecycle test pins the !session guard and the restart-only trigger.
|
🚀 This pull request is included in v6.44.1. See Release 6.44.1 for release notes. Using Knip in a commercial project? Please consider becoming a sponsor. |
Fixes #2255
If the language server fails to start (for example because of a broken
knip.json), fixing the config didn't restart it.handleFileChangesreturned early whenever there was no session, so the change was ignored until a manual restart.Now a failed
start()records the current revision. Whenknip.jsonorpackage.jsonchanges and there's no session, the server restarts only if the last start failed at that revision. A server that was stopped explicitly bumps the revision, so it stays stopped.Added tests in
lifecycle.test.jsfor both config files and for the stopped-after-failure case.