[nvim] replace null-ls with efm-langserver

This commit is contained in:
eleith 2023-08-06 15:44:46 +00:00 committed by eleith
parent 37b60e7fa8
commit 708c99e306
3 changed files with 188 additions and 119 deletions

View File

@ -41,7 +41,7 @@ return {
["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm({ select = true }),
}),
sources = {
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "nvim_diagnostic" },
{ name = "buffer" },
@ -50,7 +50,7 @@ return {
{ name = "nvim_lua" },
{ name = "nvim_lsp_signature_help" },
{ name = "emoji" },
},
}),
formatting = {
format = lspkind.cmp_format({
mode = "symbol_text",

View File

@ -2,6 +2,7 @@ return {
"neovim/nvim-lspconfig",
dependencies = {
"hrsh7th/nvim-cmp",
"creativenull/efmls-configs-nvim",
},
config = function()
local lspconfig = require("lspconfig")
@ -37,7 +38,6 @@ return {
-- LSP settings (for overriding per client)
local handlers = {}
local opts = { noremap = true, silent = true }
local on_attach = function(_, bufnr)
-- Mappings.
@ -69,25 +69,25 @@ return {
},
},
{ "tailwindcss" },
{ "flow" },
{ "graphql" },
{ "html" },
{ "intelephense" },
{ "jsonls" },
{ "pyright" },
{ "vimls" },
{ "prismals" },
{ "solargraph" },
{ "bashls" },
{ "dockerls" },
{ "solargraph" },
-- { "rubocop" }, -- needs rubocop >= 1.54
-- { "ruby_ls" }, -- wait for nvim 0.10
{ "gopls", {
root_dir = function()
return vim.loop.cwd()
end,
} },
{ "eslint" },
{
"yamlls",
{
settings = {
yaml = {
schemas = {
@ -97,16 +97,86 @@ return {
},
},
},
},
{ "stylelint_lsp" },
{ "cssls" },
{ "lua_ls" },
{
"efm",
filetypes = {
"lua",
"fish",
"ruby",
"javascript",
"typescript",
"javascriptreact",
"typescriptreact",
"javascript.tsx",
"typescript.tsx"
},
init_options = {
documentFormatting = true,
hover = true,
documentSymbol = true,
codeAction = true,
completion = true,
},
settings = {
rootMarkers = { ".git/" },
languages = {
lua = {
require("efmls-configs.linters.luacheck"),
},
fish = {
require("efmls-configs.linters.fish"),
require("efmls-configs.formatters.fish_indent"),
},
ruby = {
require("efmls-configs.linters.rubocop"),
},
javascript = {
require("efmls-configs.formatters.prettier"),
},
typescript = {
require("efmls-configs.formatters.prettier"),
},
javascriptreact = {
require("efmls-configs.formatters.prettier"),
},
typescriptreact = {
require("efmls-configs.formatters.prettier"),
},
["javascript.tsx"] = {
require("efmls-configs.formatters.prettier"),
},
["typescript.tsx"] = {
require("efmls-configs.formatters.prettier"),
},
},
},
},
{
"lua_ls",
settings = {
Lua = {
runtime = {
version = 'LuaJIT',
},
diagnostics = {
globals = { 'vim' },
},
workspace = {
library = vim.api.nvim_get_runtime_file("", true),
},
telemetry = {
enable = false,
},
},
},
},
}
for _, server in pairs(servers) do
local config = lspconfig[server[1]]
-- Only setup a language server if we have the binary available!
if vim.fn.executable(config.document_config.default_config.cmd[1]) == 1 then
local opts = {
local setup_config = {
on_attach = on_attach,
handlers = handlers,
capabilities = capabilities,
@ -115,12 +185,11 @@ return {
-- Add custom config if available
for k, v in pairs(server) do
if type(k) ~= "number" then
opts[k] = v
setup_config[k] = v
end
end
config.setup(opts)
end
config.setup(setup_config)
end
end,
}