diff options
| author | Justin M. Keyes <justinkz@gmail.com> | 2025-03-27 05:56:20 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-27 05:56:20 -0700 |
| commit | 85e0dd26b710e834a105d679200d01e326a3d2b0 (patch) | |
| tree | 970fe3a67fb88358a733cda0b38932a799e39bd1 /lua | |
| parent | docs: update configs.md (diff) | |
| download | nvim-lspconfig-85e0dd26b710e834a105d679200d01e326a3d2b0.tar nvim-lspconfig-85e0dd26b710e834a105d679200d01e326a3d2b0.tar.gz nvim-lspconfig-85e0dd26b710e834a105d679200d01e326a3d2b0.tar.bz2 nvim-lspconfig-85e0dd26b710e834a105d679200d01e326a3d2b0.tar.lz nvim-lspconfig-85e0dd26b710e834a105d679200d01e326a3d2b0.tar.xz nvim-lspconfig-85e0dd26b710e834a105d679200d01e326a3d2b0.tar.zst nvim-lspconfig-85e0dd26b710e834a105d679200d01e326a3d2b0.zip | |
fix: ":checkhealth lspconfig" fails on Nvim 0.11 #3668
Problem:
`:checkhealth lspconfig` fails:
E5009: Invalid $VIMRUNTIME: .../share/nvim/runtime
Error executing lua: Vim:E21: Cannot make changes, 'modifiable' is off
stack traceback:
[C]: in function 'append'
.../share/nvim/runtime/lua/vim/health.lua:443: in function '_check'
`:checkhealth` cannot call itself recursively. And even if it did work,
it would show a duplicate report since `:checkhealth vim.lsp` will also
be part of the report.
Solution:
On Nvim 0.11,
- show a deprecation message if invoked directly.
- show a softer message if invoked as part of the "full report".
fix #3664
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/lspconfig/health.lua | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lua/lspconfig/health.lua b/lua/lspconfig/health.lua index 02326c84..5ef54283 100644 --- a/lua/lspconfig/health.lua +++ b/lua/lspconfig/health.lua @@ -324,8 +324,16 @@ end function M.check() if vim.fn.has('nvim-0.11') == 1 then - vim.deprecate(':checkhealth lspconfig', ':checkhealth vim.lsp', '0.12', 'nvim-lspconfig', false) - vim.cmd [[checkhealth vim.lsp]] + local bufempty = vim.fn.line('$') < 3 + if bufempty then + -- Infer that `:checkhealth lspconfig` was called directly. + health.info('`:checkhealth lspconfig` was removed. Use `:checkhealth vim.lsp` instead.') + vim.deprecate(':checkhealth lspconfig', ':checkhealth vim.lsp', '0.12', 'nvim-lspconfig', false) + else + -- Healthcheck was auto-discovered by `:checkhealth` (no args). + health.info('Skipped. This healthcheck is redundant with `:checkhealth vim.lsp`.') + end + return end |
