Repository navigation
[audit] Drop vim.lsp.stop_client dead branch + fix PackChanged User event - #162
stanfish06 wants to merge 1 commit into
Conversation
vim.lsp.stop_client() is deprecated in Neovim 0.12. The config already requires 0.12+ (uses vim.pack), making the else-branch unreachable. Remove the version check and always call client:stop().
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d1c2e8e975
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| vim.api.nvim_create_autocmd("User", { | ||
| pattern = "PackChanged", |
There was a problem hiding this comment.
Use the PackChanged event directly
On Neovim 0.12, vim.pack emits PackChanged as a dedicated autocmd event, and the upstream examples register it with nvim_create_autocmd('PackChanged', ...); it is not a User event with pattern = 'PackChanged'. With this registration the fff build/download hook still will not run after :SyncPkgs, so installs/updates of fff.nvim can leave the native binary missing.
Useful? React with 👍 / 👎.
What
Two mechanical fixes in
lua/config/plugin_config.lua.1. Remove dead
vim.lsp.stop_client()branch in:LspToggleWhere:
lua/config/plugin_config.lua—LspToggleuser commandChange: Removed the
vim.fn.has('nvim-0.12')version check andelse vim.lsp.stop_client(client.id)branch. Now unconditionally callsclient:stop().Why:
vim.lsp.stop_client()is deprecated in Neovim 0.12. The config already requires 0.12+ (vim.pack,vim.lsp.config,vim.lsp.enableare all 0.12 APIs), so theelsebranch was unreachable dead code pointing at a deprecated API. The previousaudit/lsp-stop-clientbranch had added the check for backward compat; since that compat window is closed, this removes the dead path.2. Fix
PackChangedautocmd — useUserevent with pattern (closes #117)Where:
lua/config/plugin_config.lua— fff.nvimPackChangedhandlerChange:
nvim_create_autocmd("PackChanged", ...)→nvim_create_autocmd("User", { pattern = "PackChanged", ... }).Why:
vim.packfires lifecycle notifications asUserevents, not top-level Neovim events. The old registration created an autocmd that never fired, sofff.download.download_or_build_binary()was never called after:SyncPkgs. The fff.nvim native binary was never built, causingfind_files()/live_grep()to fail silently at runtime.Test plan
:LspToggle <name>on attached client → stops; run again → re-enables:SyncPkgs→ fff.nvim binary built/downloaded;:lua require("fff").find_files()worksGenerated by Claude Code