nvim: Use new non-programmatic lspconfig interface for 0.11
This commit is contained in:
parent
b22334c442
commit
1d5fbef0fb
2 changed files with 20 additions and 16 deletions
|
|
@ -35,10 +35,10 @@
|
||||||
"magick": { "branch": "master", "commit": "aa96e77b6d08983707941727a574752445de0d70" },
|
"magick": { "branch": "master", "commit": "aa96e77b6d08983707941727a574752445de0d70" },
|
||||||
"markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" },
|
"markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" },
|
||||||
"markmap.nvim": { "branch": "main", "commit": "5fb6755cf5434511cc23a4936c9eb76b9142fba5" },
|
"markmap.nvim": { "branch": "main", "commit": "5fb6755cf5434511cc23a4936c9eb76b9142fba5" },
|
||||||
"mason-conform.nvim": { "branch": "main", "commit": "1983f353b29d8716751665c18d57e1ac0473a59a" },
|
"mason-conform.nvim": { "branch": "main", "commit": "f3b96fa2217fcb1513301eefbe10ea0e765e33eb" },
|
||||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" },
|
"mason-lspconfig.nvim": { "branch": "main", "commit": "5477d67a5ca12b704f2a8a55a057fc79750f3dbb" },
|
||||||
"mason-nvim-lint": { "branch": "main", "commit": "b579a00ee39dcd590b1023028dc8fb3d203a67b0" },
|
"mason-nvim-lint": { "branch": "main", "commit": "b579a00ee39dcd590b1023028dc8fb3d203a67b0" },
|
||||||
"mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" },
|
"mason.nvim": { "branch": "main", "commit": "7f265cd6ae56cecdd0aa50c8c73fc593b0604801" },
|
||||||
"mdeval.nvim": { "branch": "master", "commit": "0e1b248db174a9659a9ab16eb8c90ff3aec55264" },
|
"mdeval.nvim": { "branch": "master", "commit": "0e1b248db174a9659a9ab16eb8c90ff3aec55264" },
|
||||||
"mini.nvim": { "branch": "main", "commit": "0420076298c4457f200c2de468f65d080597a347" },
|
"mini.nvim": { "branch": "main", "commit": "0420076298c4457f200c2de468f65d080597a347" },
|
||||||
"molten-nvim": { "branch": "main", "commit": "a286aa914d9a154bc359131aab788b5a077a5a99" },
|
"molten-nvim": { "branch": "main", "commit": "a286aa914d9a154bc359131aab788b5a077a5a99" },
|
||||||
|
|
@ -53,7 +53,7 @@
|
||||||
"nvim-colorizer.lua": { "branch": "master", "commit": "517df88cf2afb36652830df2c655df2da416a0ae" },
|
"nvim-colorizer.lua": { "branch": "master", "commit": "517df88cf2afb36652830df2c655df2da416a0ae" },
|
||||||
"nvim-coverage": { "branch": "main", "commit": "a939e425e363319d952a6c35fb3f38b34041ded2" },
|
"nvim-coverage": { "branch": "main", "commit": "a939e425e363319d952a6c35fb3f38b34041ded2" },
|
||||||
"nvim-lint": { "branch": "master", "commit": "9dfb77ef6c5092a19502883c02dc5a02ec648729" },
|
"nvim-lint": { "branch": "master", "commit": "9dfb77ef6c5092a19502883c02dc5a02ec648729" },
|
||||||
"nvim-lspconfig": { "branch": "master", "commit": "fa2662510d30b06168b6e2e6915518decde6bbac" },
|
"nvim-lspconfig": { "branch": "master", "commit": "3ea99227e316c5028f57a4d86a1a7fd01dd876d0" },
|
||||||
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
|
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
|
||||||
"nvim-surround": { "branch": "main", "commit": "0e62500b98f4513feaaf7425c135472457ea5b7d" },
|
"nvim-surround": { "branch": "main", "commit": "0e62500b98f4513feaaf7425c135472457ea5b7d" },
|
||||||
"nvim-toggleterm.lua": { "branch": "main", "commit": "50ea089fc548917cc3cc16b46a8211833b9e3c7c" },
|
"nvim-toggleterm.lua": { "branch": "main", "commit": "50ea089fc548917cc3cc16b46a8211833b9e3c7c" },
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,6 @@ local lsp = {
|
||||||
event = { "BufReadPost", "BufNewFile", "BufWritePre" },
|
event = { "BufReadPost", "BufNewFile", "BufWritePre" },
|
||||||
opts = { servers = servers },
|
opts = { servers = servers },
|
||||||
config = function(_, lspconfig_opts)
|
config = function(_, lspconfig_opts)
|
||||||
local lspconfig = require("lspconfig")
|
|
||||||
|
|
||||||
-- Display diagnostics as virtual text only if not in insert mode
|
-- Display diagnostics as virtual text only if not in insert mode
|
||||||
-- /r/neovim/comments/12inp4c/disable_diagnostics_virtual_text_when_in_insert/jqqifwk/
|
-- /r/neovim/comments/12inp4c/disable_diagnostics_virtual_text_when_in_insert/jqqifwk/
|
||||||
vim.diagnostic.config({ virtual_text = true })
|
vim.diagnostic.config({ virtual_text = true })
|
||||||
|
|
@ -50,16 +48,22 @@ local lsp = {
|
||||||
vim.fn.sign_define("DiagnosticSignInfo", { text = "", texthl = "DiagnosticSignInfo" })
|
vim.fn.sign_define("DiagnosticSignInfo", { text = "", texthl = "DiagnosticSignInfo" })
|
||||||
vim.fn.sign_define("DiagnosticSignHint", { text = "", texthl = "DiagnosticSignHint" })
|
vim.fn.sign_define("DiagnosticSignHint", { text = "", texthl = "DiagnosticSignHint" })
|
||||||
|
|
||||||
for server, config in pairs(lspconfig_opts.servers) do
|
local function register(server_name, config)
|
||||||
if vim.fn.has("nvim-0.11") == false then
|
if vim.fn.has("nvim-0.11") == 1 then
|
||||||
|
vim.lsp.config(server_name, config)
|
||||||
|
else
|
||||||
|
require("lspconfig")[server_name].setup(config)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
for server_name, config in pairs(lspconfig_opts.servers) do
|
||||||
|
register(server_name, config)
|
||||||
|
if vim.fn.has("nvim-0.11") == 0 then
|
||||||
config.capabilities = require("blink.cmp").get_lsp_capabilities(config.capabilities)
|
config.capabilities = require("blink.cmp").get_lsp_capabilities(config.capabilities)
|
||||||
end
|
end
|
||||||
lspconfig[server].setup(config)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
lspconfig.nushell.setup({})
|
register("marksman", {
|
||||||
|
|
||||||
lspconfig.marksman.setup({
|
|
||||||
filetypes = { "markdown", "quarto" },
|
filetypes = { "markdown", "quarto" },
|
||||||
on_attach = function(client, _)
|
on_attach = function(client, _)
|
||||||
-- TODO: for some reason this stays true even after rootdir switch?
|
-- TODO: for some reason this stays true even after rootdir switch?
|
||||||
|
|
@ -112,7 +116,7 @@ local lsp = {
|
||||||
local python_path
|
local python_path
|
||||||
-- ensure python virtualenv is determined automatically on lsp start
|
-- ensure python virtualenv is determined automatically on lsp start
|
||||||
-- we primarily use pyright for cmp lsp completion & hover info
|
-- we primarily use pyright for cmp lsp completion & hover info
|
||||||
lspconfig.basedpyright.setup({
|
register("basedpyright", {
|
||||||
on_attach = function(client, _)
|
on_attach = function(client, _)
|
||||||
require("core.util").set_python_env()
|
require("core.util").set_python_env()
|
||||||
if python_path == nil then
|
if python_path == nil then
|
||||||
|
|
@ -134,7 +138,7 @@ local lsp = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
lspconfig.ruff.setup({
|
register("ruff", {
|
||||||
on_attach = function(client, _)
|
on_attach = function(client, _)
|
||||||
require("core.util").set_python_env()
|
require("core.util").set_python_env()
|
||||||
client.server_capabilities.hoverProvider = false -- we use pyright for hover info
|
client.server_capabilities.hoverProvider = false -- we use pyright for hover info
|
||||||
|
|
@ -148,7 +152,7 @@ local lsp = {
|
||||||
|
|
||||||
-- set up arduino with the help of arduino.nvim plugin
|
-- set up arduino with the help of arduino.nvim plugin
|
||||||
if require("core.util").is_available("arduino") then
|
if require("core.util").is_available("arduino") then
|
||||||
lspconfig.arduino_language_server.setup({
|
register("arduino_language_server", {
|
||||||
on_new_config = require("arduino").on_new_config,
|
on_new_config = require("arduino").on_new_config,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
@ -157,7 +161,7 @@ local lsp = {
|
||||||
vim.api.nvim_create_autocmd("User", {
|
vim.api.nvim_create_autocmd("User", {
|
||||||
pattern = "SpellEnable",
|
pattern = "SpellEnable",
|
||||||
callback = function()
|
callback = function()
|
||||||
lspconfig.ltex.setup({
|
register("ltex", {
|
||||||
on_attach = function(_, _)
|
on_attach = function(_, _)
|
||||||
if require("core.util").is_available("ltex_extra") then
|
if require("core.util").is_available("ltex_extra") then
|
||||||
require("ltex_extra").setup()
|
require("ltex_extra").setup()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue