feat: rework lsp setup
This commit is contained in:
parent
81bd1447a5
commit
e7ec620b72
8 changed files with 80 additions and 60 deletions
|
@ -53,7 +53,9 @@
|
|||
nodePackages.intelephense
|
||||
nodePackages.typescript
|
||||
nodePackages.typescript-language-server
|
||||
nodePackages.vscode-json-languageserver
|
||||
nodePackages.vscode-css-languageserver-bin
|
||||
nodePackages.vscode-html-languageserver-bin
|
||||
nodePackages.vscode-json-languageserver-bin
|
||||
nodePackages.yaml-language-server
|
||||
yarn
|
||||
|
||||
|
|
|
@ -11,10 +11,7 @@ M.setup = function(opts)
|
|||
breakpoint = " ",
|
||||
currentpos = " ",
|
||||
},
|
||||
lsp_cfg = {
|
||||
on_attach = opts.on_attach,
|
||||
capabilities = opts.capabilities,
|
||||
},
|
||||
lsp_cfg = opts,
|
||||
lsp_gofumpt = true,
|
||||
lsp_keymaps = false,
|
||||
lsp_codelens = true,
|
||||
|
|
|
@ -100,7 +100,7 @@ cmp.setup({
|
|||
},
|
||||
})
|
||||
|
||||
cmp.setup.filetype("gitcommit", {
|
||||
cmp.setup.filetype({ "gitcommit", "NeogitCommitMessage" }, {
|
||||
sources = cmp.config.sources({
|
||||
{ name = "cmp_git" },
|
||||
}, {
|
||||
|
@ -158,32 +158,20 @@ vim.api.nvim_create_autocmd("LspAttach", {
|
|||
end,
|
||||
})
|
||||
|
||||
lspconfig.ltex.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = function()
|
||||
require("ltex_extra").setup({
|
||||
load_langs = { "en-US", "de-AT" },
|
||||
init_check = true,
|
||||
path = vim.fn.stdpath("data") .. "/dictionary",
|
||||
})
|
||||
end,
|
||||
settings = {
|
||||
ltex = {},
|
||||
},
|
||||
})
|
||||
|
||||
-- register jq for jqls
|
||||
vim.cmd([[au BufRead,BufNewFile *.jq setfiletype jq]])
|
||||
|
||||
local common = { capabilities = capabilities }
|
||||
|
||||
require("lsp.go").setup(common)
|
||||
require("lsp.ltex").setup(common)
|
||||
require("lsp.helm-ls")
|
||||
require("lsp.null-ls")
|
||||
require("lsp.validation").setup(common)
|
||||
require("lsp.webdev").setup(common)
|
||||
require("py_lsp").setup(common)
|
||||
require("rust-tools").setup({ server = common })
|
||||
-- external dependencies
|
||||
pcall(require("py_lsp").setup, common)
|
||||
pcall(require("rust-tools").setup, { server = common })
|
||||
|
||||
local servers = {
|
||||
"astro",
|
||||
|
|
25
home/apps/neovim/lua/lsp/ltex.lua
Normal file
25
home/apps/neovim/lua/lsp/ltex.lua
Normal file
|
@ -0,0 +1,25 @@
|
|||
local lsp_present, lspconfig = pcall(require, "lspconfig")
|
||||
|
||||
if not lsp_present then
|
||||
return
|
||||
end
|
||||
|
||||
local M = {}
|
||||
|
||||
M.setup = function(opts)
|
||||
lspconfig.ltex.setup({
|
||||
capabilities = opts.capabilities,
|
||||
on_attach = function()
|
||||
require("ltex_extra").setup({
|
||||
load_langs = { "en-US", "de-AT" },
|
||||
init_check = true,
|
||||
path = vim.fn.stdpath("data") .. "/dictionary",
|
||||
})
|
||||
end,
|
||||
settings = {
|
||||
ltex = {},
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
|
@ -1,5 +1,9 @@
|
|||
-- Null LS
|
||||
local null = require("null-ls")
|
||||
local null_present, null = pcall(require, "null-ls")
|
||||
|
||||
if not null_present then
|
||||
return
|
||||
end
|
||||
|
||||
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
|
||||
|
||||
null.setup({
|
||||
|
@ -17,7 +21,6 @@ null.setup({
|
|||
null.builtins.formatting.gofumpt,
|
||||
null.builtins.formatting.isort,
|
||||
null.builtins.formatting.prettier,
|
||||
-- null.builtins.formatting.rustfmt,
|
||||
null.builtins.formatting.shfmt,
|
||||
null.builtins.formatting.stylua,
|
||||
null.builtins.formatting.taplo,
|
||||
|
|
|
@ -1,21 +1,22 @@
|
|||
local lspconfig = require("lspconfig")
|
||||
local lsp_present, lspconfig = pcall(require, "lspconfig")
|
||||
|
||||
if not lsp_present then
|
||||
return
|
||||
end
|
||||
|
||||
local M = {}
|
||||
|
||||
M.setup = function(opts)
|
||||
lspconfig.jsonls.setup({
|
||||
capabilities = opts.capabilities,
|
||||
on_attach = opts.on_attach,
|
||||
lspconfig.jsonls.setup(vim.tbl_extend("keep", {
|
||||
cmd = { "json-languageserver", "--stdio" },
|
||||
settings = {
|
||||
json = {
|
||||
schemas = require("schemastore").json.schemas(),
|
||||
validate = { enable = true },
|
||||
},
|
||||
},
|
||||
})
|
||||
lspconfig.yamlls.setup({
|
||||
capabilities = opts.capabilities,
|
||||
on_attach = opts.on_attach,
|
||||
}, opts))
|
||||
lspconfig.yamlls.setup(vim.tbl_extend("keep", {
|
||||
settings = {
|
||||
yaml = {
|
||||
completion = true,
|
||||
|
@ -44,8 +45,13 @@ M.setup = function(opts)
|
|||
},
|
||||
},
|
||||
},
|
||||
redhat = {
|
||||
telemetry = {
|
||||
enabled = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
}, opts))
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
@ -1,49 +1,48 @@
|
|||
local lspconfig = require("lspconfig")
|
||||
local lsp_present, lspconfig = pcall(require, "lspconfig")
|
||||
|
||||
if not lsp_present then
|
||||
return
|
||||
end
|
||||
|
||||
local M = {}
|
||||
|
||||
M.setup = function(opts)
|
||||
local common = {
|
||||
capabilities = opts.capabilities,
|
||||
on_attach = opts.on_attach,
|
||||
}
|
||||
lspconfig.cssls.setup(common)
|
||||
lspconfig.emmet_ls.setup(common)
|
||||
lspconfig.graphql.setup({
|
||||
capabilities = opts.capabilities,
|
||||
on_attach = opts.on_attach,
|
||||
lspconfig.cssls.setup(vim.tbl_extend("keep", {
|
||||
cmd = { "css-languageserver", "--stdio" },
|
||||
}, opts))
|
||||
lspconfig.emmet.setup(opts)
|
||||
lspconfig.graphql.setup(vim.tbl_extend("keep", {
|
||||
filetypes = {
|
||||
"graphql",
|
||||
"typescriptreact",
|
||||
"javascriptreact",
|
||||
"typescript",
|
||||
},
|
||||
})
|
||||
lspconfig.intelephense.setup(common)
|
||||
lspconfig.tailwindcss.setup({
|
||||
capabilities = opts.capabilities,
|
||||
on_attach = opts.on_attach,
|
||||
}, opts))
|
||||
lspconfig.html.setup(vim.tbl_extend("keep", {
|
||||
cmd = { "html-languageserver", "--stdio" },
|
||||
}, opts))
|
||||
lspconfig.intelephense.setup(opts)
|
||||
lspconfig.tailwindcss.setup(vim.tbl_extend("keep", {
|
||||
filetypes = {
|
||||
"javascriptreact",
|
||||
"typescriptreact",
|
||||
"html",
|
||||
"css",
|
||||
},
|
||||
})
|
||||
}, opts))
|
||||
|
||||
-- attach tsserver only when there's a 'package.json' file in the CWD
|
||||
lspconfig.tsserver.setup({
|
||||
capabilities = opts.capabilities,
|
||||
on_attach = opts.on_attach,
|
||||
lspconfig.tsserver.setup(vim.tbl_extend("keep", {
|
||||
root_dir = lspconfig.util.root_pattern("package.json"),
|
||||
single_file_support = false,
|
||||
})
|
||||
}, opts))
|
||||
|
||||
-- attach deno only when there's a 'deps.ts' file in the CWD
|
||||
lspconfig.denols.setup({
|
||||
capabilities = opts.capabilities,
|
||||
on_attach = opts.on_attach,
|
||||
lspconfig.denols.setup(vim.tbl_extend("keep", {
|
||||
root_dir = lspconfig.util.root_pattern("deps.ts"),
|
||||
single_file_support = false,
|
||||
})
|
||||
}, opts))
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
local bc = vim.g.bc
|
||||
|
||||
-- stylua: ignore
|
||||
local no_preview = function(opts)
|
||||
local defaults = require("telescope.themes").get_dropdown({
|
||||
-- stylua: ignore
|
||||
borderchars = {
|
||||
{ bc.horiz, bc.vert, bc.horiz, bc.vert, bc.topleft, bc.topright, bc.botright, bc.botleft },
|
||||
prompt = { bc.horiz, bc.vert, " ", bc.vert, bc.topleft, bc.topright, bc.vert, bc.vert },
|
||||
|
@ -14,7 +14,7 @@ local no_preview = function(opts)
|
|||
prompt_title = false,
|
||||
results_title = false,
|
||||
})
|
||||
return vim.tbl_deep_extend("force", defaults, opts or {})
|
||||
return vim.tbl_deep_extend("keep", opts or {}, defaults)
|
||||
end
|
||||
|
||||
---@type LazySpec[]
|
||||
|
|
Loading…
Reference in a new issue