Skip to content

Commit 2198b4d

Browse files
committed
add additional notes on mason config to README
1 parent 7504bba commit 2198b4d

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

README.md

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ Lazy-Nix-Helper searches the nix store for all installed vim plugins and builds
2828

2929
## Requirements
3030

31+
Note: the docs list neovim version >= 0.9.0 as a requirement. It will probably work for much earlier versions, but that's all I've tested it on so far.
32+
3133
TODO:
3234
- compatible neovim versions?
3335
- nixos compatibility?
@@ -181,7 +183,13 @@ Mason is a package manager for LSP servers, DAP servers, linters, and formatters
181183

182184
This will require you to separately declare all your LSP servers etc. in your NixOS config, but you were doing that already, right?
183185

184-
Here's an example mason configuration as a dependency of `nvim-lspconfig`. Notice that we are using `mason_enabled` to conditionally enable both `mason` and `mason-lspconfig
186+
There are two parts to this:
187+
1. disabling the `mason` (and `mason-lspconfig`) plugins
188+
2. checking that `mason` (and `mason-lspconfig`) are enabled before they are used elsewhere in your config
189+
190+
**Conditionally enabling mason**
191+
192+
Here's an example mason configuration as a dependency of `nvim-lspconfig`. Notice that we are using `mason_enabled` to conditionally enable both `mason` and `mason-lspconfig`
185193

186194
```Lua
187195
{
@@ -190,13 +198,11 @@ Here's an example mason configuration as a dependency of `nvim-lspconfig`. Notic
190198
dependencies = {
191199
{
192200
"williamboman/mason.nvim",
193-
dir = require("lazy-nix-helper").get_plugin_path("mason.nvim"),
194201
enable = require("lazy-nix-helper").mason_enabled(),
195202
...
196203
},
197204
{
198205
"williamboman/mason-lspconfig.nvim",
199-
dir = require("lazy-nix-helper").get_plugin_path("mason-lspconfig.nvim"),
200206
enable = require("lazy-nix-helper").mason_enabled(),
201207
...
202208
},
@@ -206,8 +212,24 @@ Here's an example mason configuration as a dependency of `nvim-lspconfig`. Notic
206212
}
207213
```
208214

209-
TODO: do we have to load these things by hand now or is it sufficient to have them installed on the system?
215+
Note that specifying the `dir` parameter is not necessary here since these plugins will be disabled in NixOS.
216+
217+
**Conditionally calling mason**
218+
219+
This part is harder to give examples for because there are a lot of ways you could be setting this up.
220+
221+
I based my original neovim configuration on [kickstart.nvim](https://github.com/nvim-lua/kickstart.nvim/tree/master), which had checks that `mason` and `mason-lspconfig` were enabled already built again. This was before they migrated to using Lazy, and it looks like this has changed sense.
222+
223+
Some general advice:
224+
225+
- You can still use the `mason_enabled()` function to gate `mason` or `mason-lspconfig` calls in your configuration
226+
- Make sure that `lsp-config.setup()` function is still called for each server
227+
228+
After making these changes in my own config LSP servers were working for me on NixOS.
229+
230+
**Caveat for Linters and Formatters**
210231

232+
In my own config I don't use linters or formatters provided by mason. I prefer to handle that on a per-project basis or use tools provided by the language. I haven't tested this plugin with a configuration that includes linters or formatters, and can't confirm that they work with this setup.
211233

212234
## Known Limitations
213235

0 commit comments

Comments
 (0)