nvf icon indicating copy to clipboard operation
nvf copied to clipboard

neovim/lsp: expose low-level API

Open NotAShelf opened this issue 8 months ago • 1 comments

  • lib/languages: add lspOptions submodule type for freeform LSP config
  • lib/languages: add root_marker to lspOptions type
  • neovim/lsp: init
  • lib/languages: add explicit enable to LSP submodule
  • lib/lua: deprecate old Lua helpers superseded by toLuaObject

This exposes a low(er) level API for configuring LSPs directly with the new options provided by Neovim 0.11. The idea is to allow configuring LSPs without relying on the inclusion of language modules into nvf, or allowing language modules in user configurations.

The language modules still use the old API, and will be migrated in due time. Changes here are split off to avoid withholding important additions to the module system until all language modules are converted. Language modules, of course, will still need to be converted to this new API, after which lspconfig shall be made into a regular plugin module instead of its current, specially treated "variant."

Related: https://github.com/NotAShelf/nvf/discussions/748

NotAShelf avatar Apr 25 '25 11:04 NotAShelf

:rocket: Live preview deployed from 3147ef13711464ec555f8897c1179c55ca76ec77

View it here:

Debug Information

Triggered by: horriblename

HEAD at: lsp-api

Reruns: 747

github-actions[bot] avatar Apr 25 '25 11:04 github-actions[bot]

✅ Preview has been deleted successfully!

github-actions[bot] avatar Apr 28 '25 05:04 github-actions[bot]

Note: this breaks if you're not on neovim 0.11.0+ as vim.lsp.config wasn't introduced until then.

I found it as I'm on nix-stable-24.11 until 25.05 comes out, and that has neovim v0.10.2 still.

Error from today:

Error detected while processing VIMINIT..script /nix/store/n3l1rbdiznj7scgmlmfw7ixkpgjvjpnv-neovim-pack-dir/init.lua:
E5113: Error while calling lua chunk: /nix/store/3z4gd16qap9d9v8syz51qlnisy3gij5i-init.lua:435: attempt to index field 'config' (a nil value)
stack traceback:
        /nix/store/3z4gd16qap9d9v8syz51qlnisy3gij5i-init.lua:435: in main chunk
        [C]: in function 'dofile'
        ...3l1rbdiznj7scgmlmfw7ixkpgjvjpnv-neovim-pack-dir/init.lua:13: in main chunk
Press ENTER or type command to continue

neovim version:

❯ nvim -V1 -v
NVIM v0.10.2
Build type: Release
LuaJIT 2.1.1713773202

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "
/nix/store/wswwc2v8xkcksy1sym3kyw01ynvw0947-neovim-unwrapped-0.10.2/share/nvim
"

Run :checkhealth for more info

jeckhart avatar Apr 28 '25 16:04 jeckhart

Please do not override nvf's nixpkgs version. I know this can be (and should be) communicated better, but we only target nixpkgs unstable since we do not have the manpower to divert energy to supporting the stable branch. You can remove the follows line, and it should work as intended.

NotAShelf avatar Apr 28 '25 16:04 NotAShelf