feat(neovim): setup nixfmt & nix-linter

nix-linter setup doesn't seem to fully work yet
This commit is contained in:
Felix Schröter 2021-11-27 21:16:31 +01:00
parent 2d27c1f2aa
commit fc3eb14f3f
No known key found for this signature in database
GPG key ID: 910ACB9F6BD26F58
2 changed files with 25 additions and 0 deletions
home/editors
lsp.nix
neovim/lsp

View file

@ -19,6 +19,13 @@
# linters & formatters
nodePackages.eslint
# TODO uses custom script until json support is fixed
(pkgs.writeScriptBin "nix-linter" ''
echo '['
${nix-linter}/bin/nix-linter --json-stream "$1" | sed '$!s/$/,/'
echo ']'
'')
nixfmt
# nodePackages.stylelint
nodePackages.prettier
];

View file

@ -61,6 +61,7 @@ config.diagnosticls.setup{
"json",
"yaml",
"markdown",
"nix",
"html",
"css"
},
@ -117,6 +118,19 @@ config.diagnosticls.setup{
warning = "warning",
},
},
["nix-linter"] = {
-- TODO uses custom script until json support is fixed
command = "nix-linter",
sourceName = "nix-linter",
debounce = 50,
parseJson = {
line = "pos.spanBegin.sourceLine",
column = "pos.spanBegin.sourceColumn",
endLine = "pos.spanEnd.sourceLine",
endColumn = "pos.spanEnd.sourceColumn",
message = "${description}",
},
},
},
filetypes = {
javascript = {"eslint"},
@ -126,6 +140,7 @@ config.diagnosticls.setup{
["typescript.jsx"] = {"eslint"},
typescriptreact = {"eslint"},
css = {"stylelint"},
nix = {"nix-linter"},
},
formatters = {
eslint = {
@ -159,6 +174,9 @@ config.diagnosticls.setup{
},
rootPatterns = {".prettierrc.json", ".git"},
},
nixfmt = {
command = "nixfmt",
},
},
formatFiletypes = {
javascript = {"eslint"},