1- *lazy-nix-helper.nvim.txt* For Neovim >= 0.8 .0? Last change: 2023 December 04
1+ *lazy-nix-helper.nvim.txt* For Neovim >= 0.9 .0? Last change: 2023 December 04
22
33==============================================================================
44Table of Contents *lazy-nix-helper.nvim-table-of-contents*
@@ -62,6 +62,9 @@ given plugin name.
6262
6363REQUIREMENTS *lazy-nix-helper.nvim-lazy-nix-helper-requirements*
6464
65+ Note: the docs list neovim version >= 0.9.0 as a requirement. It will probably
66+ work for much earlier versions, but that’s all I’ve tested it on so far.
67+
6568TODO: - compatible neovim versions? - nixos compatibility? - dependencies? -
6669neovim io.popen() not available on all platforms
6770
@@ -237,9 +240,15 @@ enable Mason.
237240This will require you to separately declare all your LSP servers etc. in your
238241NixOS config, but you were doing that already, right?
239242
243+ There are two parts to this: 1. disabling the `mason` (and `mason- lspconfig` )
244+ plugins 2. checking that `mason` (and `mason- lspconfig` ) are enabled before
245+ they are used elsewhere in your config
246+
247+ **Conditionally enabling mason**
248+
240249Here’s an example mason configuration as a dependency of `nvim- lspconfig` .
241250Notice that we are using `mason_enabled` to conditionally enable both `mason`
242- and `mason-lspconfig
251+ and `mason- lspconfig`
243252
244253>lua
245254 {
@@ -248,13 +257,11 @@ and `mason-lspconfig
248257 dependencies = {
249258 {
250259 "williamboman/mason.nvim",
251- dir = require("lazy-nix-helper").get_plugin_path("mason.nvim"),
252260 enable = require("lazy-nix-helper").mason_enabled(),
253261 ...
254262 },
255263 {
256264 "williamboman/mason-lspconfig.nvim",
257- dir = require("lazy-nix-helper").get_plugin_path("mason-lspconfig.nvim"),
258265 enable = require("lazy-nix-helper").mason_enabled(),
259266 ...
260267 },
@@ -264,8 +271,33 @@ and `mason-lspconfig
264271 }
265272<
266273
267- TODO: do we have to load these things by hand now or is it sufficient to have
268- them installed on the system?
274+ Note that specifying the `dir ` parameter is not necessary here since these
275+ plugins will be disabled in NixOS.
276+
277+ **Conditionally calling mason**
278+
279+ This part is harder to give examples for because there are a lot of ways you
280+ could be setting this up.
281+
282+ I based my original neovim configuration on kickstart.nvim
283+ <https://github.com/nvim-lua/kickstart.nvim/tree/master >, which had checks that
284+ `mason` and `mason- lspconfig` were enabled already built again. This was before
285+ they migrated to using Lazy, and it looks like this has changed sense.
286+
287+ Some general advice:
288+
289+ - You can still use the `mason_enabled ()` function to gate `mason` or `mason- lspconfig` calls in your configuration
290+ - Make sure that `lsp - config.setup ()` function is still called for each server
291+
292+ After making these changes in my own config LSP servers were working for me on
293+ NixOS.
294+
295+ **Caveat for Linters and Formatters**
296+
297+ In my own config I don’t use linters or formatters provided by mason. I
298+ prefer to handle that on a per-project basis or use tools provided by the
299+ language. I haven’t tested this plugin with a configuration that includes
300+ linters or formatters, and can’t confirm that they work with this setup.
269301
270302
271303KNOWN LIMITATIONS *lazy-nix-helper.nvim-lazy-nix-helper-known-limitations*
0 commit comments