Skip to content

Commit

Permalink
add efm example to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dundalek committed Apr 14, 2024
1 parent e7cb65f commit f9b6826
Showing 1 changed file with 35 additions and 2 deletions.
37 changes: 35 additions & 2 deletions notes.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Override used Nix packages
## Override used Nix packages

In case you need to specify custom nix packages, you can override the default ones by specifying `on_new_config` callback with `in_shell` helper function:

Expand All @@ -16,7 +16,40 @@ require("lazy-lsp").setup {
}
```

# Install via Nix/Home Manager
## Additional Linters and Formatters (EFM)

You can use [efm-langserver](https://github.com/mattn/efm-langserver) to set up additional formatters and linters when LSP implementation is not available.

For example, use following config to get [shellcheck](https://www.shellcheck.net/) diagnostic messages when writing shell scripts:

```lua
require("lazy-lsp").setup {
configs = {
efm = {
filetypes = { "sh" },
settings = {
languages = {
sh = {
{
lintCommand = "shellcheck -f gcc -x",
lintSource = "shellcheck",
lintFormats = { "%f:%l:%c: %trror: %m", "%f:%l:%c: %tarning: %m",
"%f:%l:%c: %tote: %m" },
},
},
},
},
on_new_config = function(new_config)
-- Override used packages to add additional dependencies
local nix_pkgs = { "efm-langserver", "shellcheck" }
new_config.cmd = require("lazy-lsp").in_shell(nix_pkgs, new_config.cmd)
end,
},
},
}
```

## Install via Nix/Home Manager

`lazy-lsp-nvim` is available in the unstable channel. Install with:

Expand Down

0 comments on commit f9b6826

Please sign in to comment.