1
0
Fork 0

Switch to null-ls

This commit is contained in:
Daniel Kempkens 2021-12-18 23:05:38 +01:00
parent 1491e0cabd
commit 8ce9e36a82
7 changed files with 43 additions and 129 deletions

View file

@ -1,78 +0,0 @@
version: 2
root-markers:
- .git/
- flake.nix
lint-debounce: '200ms'
tools:
dockerfile-hadolint: &dockerfile-hadolint
lint-command: 'efm-hadolint'
lint-formats:
- '%f:%l:%trror: %m'
- '%f:%l:%tarning: %m'
- '%f:%l:%tnfo: %m'
- '%f:%l:%ttyle: %m'
elixir-credo: &elixir-credo
lint-command: >
mix credo suggest --all-priorities --format flycheck --read-from-stdin ${INPUT} |
sed "s/ R:/ H:/; s/ D:/ I:/; s/ C:/ W:/"
lint-stdin: true
lint-formats:
- '%f:%l:%c: %t: %m'
- '%f:%l: %t: %m'
root-markers:
- mix.lock
- mix.exs
eruby-erb: &eruby-erb
lint-command: 'erb -x -T - | ruby -c'
lint-stdin: true
lint-offset: 1
fish-indent: &fish-indent
format-command: 'fish_indent'
format-stdin: true
javascript-eslint: &javascript-eslint
lint-command: 'eslint_d -f visualstudio --stdin --stdin-filename ${INPUT}'
lint-ignore-exit-code: true
lint-stdin: true
lint-formats:
- "%f(%l,%c): %tarning %m"
- "%f(%l,%c): %rror %m"
format-command: 'eslint_d --fix-to-stdout --stdin --stdin-filename=${INPUT}'
format-stdin: true
root-markers:
- .eslintrc.js
sh-shfmt: &sh-shfmt
format-command: 'shfmt -i 2'
format-stdin: true
sh-shellcheck: &sh-shellcheck
lint-command: 'shellcheck -f gcc -x'
lint-formats:
- '%f:%l:%c: %trror: %m'
- '%f:%l:%c: %tarning: %m'
- '%f:%l:%c: %tote: %m'
languages:
dockerfile:
- <<: *dockerfile-hadolint
elixir:
- <<: *elixir-credo
eruby:
- <<: *eruby-erb
fish:
- <<: *fish-indent
javascript:
- <<: *javascript-eslint
sh:
- <<: *sh-shellcheck
- <<: *sh-shfmt

View file

@ -79,10 +79,10 @@ local default_config = {
} }
local default_servers = { local default_servers = {
'angularls',
'bashls', 'bashls',
'cssls', 'cssls',
'dockerls', 'dockerls',
'eslint',
'html', 'html',
'rnix', 'rnix',
'sqls', 'sqls',
@ -153,37 +153,3 @@ lsp.sumneko_lua.setup(vim.tbl_extend('force', default_config, {
}, },
}, },
})) }))
-- Try to start efm as the last language server
lsp.efm.setup(vim.tbl_extend('force', default_config, {
cmd = {
'efm-langserver',
'-c',
vim.fn.globpath('~', '.config/nvim/efm.yml'),
},
filetypes = {
'dockerfile',
'elixir',
'fish',
'javascript',
'sh',
},
on_attach = function(client, bufnr)
local disable_formatter_ft = { 'dockerfile', 'elixir' }
local slow_ft = {}
if vim.tbl_contains(disable_formatter_ft, vim.bo.filetype) then
client.resolved_capabilities.document_formatting = false
end
if vim.tbl_contains(slow_ft, vim.bo.filetype) then
client.resolved_capabilities.text_document_did_change = vim.lsp.protocol.TextDocumentSyncKind.None
end
client.resolved_capabilities.document_symbol = false
client.resolved_capabilities.workspace_symbol = false
custom_attach(client, bufnr)
end,
}))

View file

@ -0,0 +1,12 @@
local null_ls = require('null-ls')
local builtins = null_ls.builtins
null_ls.setup({
sources = {
builtins.diagnostics.credo,
builtins.formatting.fish_indent,
builtins.diagnostics.hadolint,
builtins.diagnostics.shellcheck.with({extra_args = { '-f', 'gcc', '-x' }}),
builtins.formatting.shfmt.with({extra_args = { '-i', '2' }}),
},
})

View file

@ -39,6 +39,7 @@ require('nifoc.config.todo_comments')
-- LSP -- LSP
require('nifoc.config.lsp') require('nifoc.config.lsp')
require('nifoc.config.null_ls')
require('nifoc.config.lsp_trouble') require('nifoc.config.lsp_trouble')
require('nifoc.config.illuminate') require('nifoc.config.illuminate')

View file

@ -22,7 +22,6 @@ in
tree-sitter tree-sitter
# LSP # LSP
efm-langserver
nodePackages.bash-language-server nodePackages.bash-language-server
nodePackages.dockerfile-language-server-nodejs nodePackages.dockerfile-language-server-nodejs
nodePackages.vscode-langservers-extracted nodePackages.vscode-langservers-extracted
@ -70,6 +69,7 @@ in
# LSP # LSP
nvim-lspconfig nvim-lspconfig
null-ls-nvim
trouble-nvim trouble-nvim
lspkind-nvim lspkind-nvim
lsp-status-nvim lsp-status-nvim

View file

@ -99,12 +99,12 @@
}; };
nvim-treesitter = pkgs.vimUtils.buildVimPluginFrom2Nix { nvim-treesitter = pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = "nvim-treesitter"; pname = "nvim-treesitter";
version = "1639733818"; version = "1639864170";
src = pkgs.fetchFromGitHub { src = pkgs.fetchFromGitHub {
owner = "nvim-treesitter"; owner = "nvim-treesitter";
repo = "nvim-treesitter"; repo = "nvim-treesitter";
rev = "296c28be5396da069e436f58bdaa541506f99fb5"; rev = "e01c7ce9727b9d18b71b41cc792cb4719e469598";
sha256 = "+IPX8rrNIkZCIsY/6hzm4vLuSrTgA+4R54hmJFvIV/4="; sha256 = "I9+GPTRkKaT8MN9Vqeif6SG3NqzUA7qvKxcYWVsSHKY=";
fetchSubmodules = false; fetchSubmodules = false;
}; };
meta.homepage = "https://github.com/nvim-treesitter/nvim-treesitter"; meta.homepage = "https://github.com/nvim-treesitter/nvim-treesitter";
@ -206,6 +206,18 @@
}; };
meta.homepage = "https://github.com/neovim/nvim-lspconfig"; meta.homepage = "https://github.com/neovim/nvim-lspconfig";
}; };
null-ls-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = "null-ls.nvim";
version = "1639855372";
src = pkgs.fetchFromGitHub {
owner = "jose-elias-alvarez";
repo = "null-ls.nvim";
rev = "b9a1db1990e6c7e27cfe5f6b0a7fbae47dc63849";
sha256 = "tv1IAfrWe7lJGOY25WnxgKPhgxpGQ1OwaDs6pIbuagA=";
fetchSubmodules = false;
};
meta.homepage = "https://github.com/jose-elias-alvarez/null-ls.nvim";
};
nvim-web-devicons = pkgs.vimUtils.buildVimPluginFrom2Nix { nvim-web-devicons = pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = "nvim-web-devicons"; pname = "nvim-web-devicons";
version = "1639689176"; version = "1639689176";
@ -256,12 +268,12 @@
}; };
nvim-cmp = pkgs.vimUtils.buildVimPluginFrom2Nix { nvim-cmp = pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = "nvim-cmp"; pname = "nvim-cmp";
version = "1639533818"; version = "1639842196";
src = pkgs.fetchFromGitHub { src = pkgs.fetchFromGitHub {
owner = "hrsh7th"; owner = "hrsh7th";
repo = "nvim-cmp"; repo = "nvim-cmp";
rev = "4efecf7f5b86949de387e63fa86715bc39f92219"; rev = "b11f8bbee3d7ba5190b043e23bd6f5b9cb82382c";
sha256 = "RTUqz4hTvnaLNMaqQcDJMRxv2+c2nf+IoiEWGm69cfU="; sha256 = "xiC5cCUE18S5M2rxDXCTwLV5ZmCy6Z7lDzur53xVAQ0=";
fetchSubmodules = false; fetchSubmodules = false;
}; };
meta.homepage = "https://github.com/hrsh7th/nvim-cmp"; meta.homepage = "https://github.com/hrsh7th/nvim-cmp";
@ -280,12 +292,12 @@
}; };
LuaSnip = pkgs.vimUtils.buildVimPluginFrom2Nix { LuaSnip = pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = "LuaSnip"; pname = "LuaSnip";
version = "1639761885"; version = "1639780167";
src = pkgs.fetchFromGitHub { src = pkgs.fetchFromGitHub {
owner = "L3MON4D3"; owner = "L3MON4D3";
repo = "LuaSnip"; repo = "LuaSnip";
rev = "6c2499594871d8403a5d7db80cbe35bc317fc8ed"; rev = "6bcd3bb65ebb3e82afb460587590a80350eba1a1";
sha256 = "DEEF9nRVVCA3ks+NE/wrnlm2ik8jXu9t5TfjichgfUM="; sha256 = "Vov0jpRpUkubfFmh93pC13pa7a/97e8zy2nsT0rUjE4=";
fetchSubmodules = false; fetchSubmodules = false;
}; };
meta.homepage = "https://github.com/L3MON4D3/LuaSnip"; meta.homepage = "https://github.com/L3MON4D3/LuaSnip";
@ -316,12 +328,12 @@
}; };
cmp-path = pkgs.vimUtils.buildVimPluginFrom2Nix { cmp-path = pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = "cmp-path"; pname = "cmp-path";
version = "1639492848"; version = "1639837442";
src = pkgs.fetchFromGitHub { src = pkgs.fetchFromGitHub {
owner = "hrsh7th"; owner = "hrsh7th";
repo = "cmp-path"; repo = "cmp-path";
rev = "56a0fe5c46835ecc6323bda69f3924758b991590"; rev = "e1a69161703171f5804d311005a73b742fbda123";
sha256 = "/dFsJ6er4H0jF79RvoWRh77asEKFyxoN2Yw5Gml72Pc="; sha256 = "wdARGRz1TU/Igb2J49lB2zp/+gFEnTQFipMZOM2A81o=";
fetchSubmodules = false; fetchSubmodules = false;
}; };
meta.homepage = "https://github.com/hrsh7th/cmp-path"; meta.homepage = "https://github.com/hrsh7th/cmp-path";
@ -460,12 +472,12 @@
}; };
lualine-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix { lualine-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = "lualine.nvim"; pname = "lualine.nvim";
version = "1639398150"; version = "1639832649";
src = pkgs.fetchFromGitHub { src = pkgs.fetchFromGitHub {
owner = "nvim-lualine"; owner = "nvim-lualine";
repo = "lualine.nvim"; repo = "lualine.nvim";
rev = "c4a09735a68c30981c223310848f0649235ec2be"; rev = "3a17c8f05aae1f148b8af595b46fea18b74d0573";
sha256 = "EKzI6+mslbJR8TjmASpuHZlZ6gUh3O/+Stelz3QKsT8="; sha256 = "VOIbDCeOBV1YPXl9VMz6aKaC7F+CSnlr/AEWX8jNw3s=";
fetchSubmodules = false; fetchSubmodules = false;
}; };
meta.homepage = "https://github.com/nvim-lualine/lualine.nvim"; meta.homepage = "https://github.com/nvim-lualine/lualine.nvim";

View file

@ -15,6 +15,7 @@ nvim-telescope/telescope.nvim
nvim-telescope/telescope-fzf-native.nvim/make nvim-telescope/telescope-fzf-native.nvim/make
ahmedkhalf/project.nvim ahmedkhalf/project.nvim
neovim/nvim-lspconfig neovim/nvim-lspconfig
jose-elias-alvarez/null-ls.nvim
kyazdani42/nvim-web-devicons kyazdani42/nvim-web-devicons
folke/trouble.nvim folke/trouble.nvim
onsails/lspkind-nvim onsails/lspkind-nvim