nix-community / nixvim

Configure Neovim with Nix! [maintainers=@GaetanLepage, @traxys, @mattsturgeon, @khaneliman]
https://nix-community.github.io/nixvim
MIT License
1.81k stars 282 forks source link

[BUG] `plugins.lsp.*.filetypes` should be nil-able #2361

Open meck opened 1 month ago

meck commented 1 month ago
Field Description
Plugin All LSP Plugins
Nixpkgs unstable
Home Manager unstable

Description

plugins.lsp.*.filestypes should be able to generate a nil lua value, currently any null value is filtered out, falling back to nvim-lspconfig default value which makes sense. However to activate a lsp for any filetype this should be forced to nil.

The scenario I'm looking at is enabling ltex-ls for all files (with autostart = false) and starting it manually using LspStart where needed. I don't know if an empty list should be transformed to nil or the rawLua type should just be enabled as possible type?

MattSturgeon commented 1 month ago

This is a bit more of a general issue in nixvim. Our to-lua generator currently assumes that null-or-empty value should not be rendered as lua.

There's a few historical reasons for this, but it leads to frustration in cases like this where we actually want to include a nil or a {} in the output...

MattSturgeon commented 1 month ago

One workaround is to use our "raw lua" feature:

{
  foo.__raw = "nil";
  bar.__raw = "{}";
}