refactor: improve lsp config

preparing the code to migrate out of lsp-zero (not maintained anymore)
This commit is contained in:
Seymur Bagirov 2025-02-24 11:23:22 +04:00
parent 63965068e6
commit 78a1c3bcfb
4 changed files with 26 additions and 39 deletions

View File

@ -45,11 +45,6 @@ return {
}, },
"SmiteshP/nvim-navic", "SmiteshP/nvim-navic",
"Decodetalkers/csharpls-extended-lsp.nvim", "Decodetalkers/csharpls-extended-lsp.nvim",
-- {
-- "lukas-reineke/headlines.nvim",
-- dependencies = "nvim-treesitter/nvim-treesitter",
-- config = true, -- or `opts = {}`
-- },
{ {
'MeanderingProgrammer/markdown.nvim', 'MeanderingProgrammer/markdown.nvim',
main = "render-markdown", main = "render-markdown",

View File

@ -1,14 +0,0 @@
return {
{
"folke/lazydev.nvim",
ft = "lua", -- only load on lua files
opts = {
library = {
-- See the configuration section for more details
-- Load luvit types when the `vim.uv` word is found
{ path = "luvit-meta/library", words = { "vim%.uv" } },
},
},
},
{ "Bilal2453/luvit-meta", lazy = true }, -- optional `vim.uv` typings
}

View File

@ -1,4 +1,4 @@
return { local rust = {
{ {
'mrcjkb/rustaceanvim', 'mrcjkb/rustaceanvim',
version = '^5', -- Recommended version = '^5', -- Recommended
@ -26,6 +26,9 @@ return {
vim.keymap.set("n", "<leader>cf", crates.show_features_popup, opts) vim.keymap.set("n", "<leader>cf", crates.show_features_popup, opts)
end, end,
}, },
}
local go = {
{ {
"ray-x/go.nvim", "ray-x/go.nvim",
dependencies = { -- optional packages dependencies = { -- optional packages
@ -34,6 +37,27 @@ return {
ft = { "go", 'gomod' }, ft = { "go", 'gomod' },
build = ':lua require("go.install").update_all_sync()' -- if you need to install/update all binaries build = ':lua require("go.install").update_all_sync()' -- if you need to install/update all binaries
}, },
}
local lazydev = {
{
"folke/lazydev.nvim",
ft = "lua", -- only load on lua files
opts = {
library = {
-- See the configuration section for more details
-- Load luvit types when the `vim.uv` word is found
{ path = "luvit-meta/library", words = { "vim%.uv" } },
},
},
},
{ "Bilal2453/luvit-meta", lazy = true }, -- optional `vim.uv` typings
}
return {
lazydev,
rust,
go,
{ {
'VonHeikemen/lsp-zero.nvim', 'VonHeikemen/lsp-zero.nvim',
branch = 'v3.x', branch = 'v3.x',
@ -123,18 +147,6 @@ return {
}, },
init_options = { userLanguages = { rust = "html", templ = "html" } }, init_options = { userLanguages = { rust = "html", templ = "html" } },
}) })
--
-- lsp.configure("rust_analyzer", {
-- settings = {
-- ["rust-analyzer"] = {
-- checkOnSave = true,
-- check = {
-- command = "clippy"
-- }
-- }
-- }
-- })
local cmp = require('cmp') local cmp = require('cmp')
@ -221,6 +233,7 @@ return {
navbuddy.attach(client, bufnr) navbuddy.attach(client, bufnr)
end end
vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts) vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
vim.keymap.set("n", "gD", function() vim.lsp.buf.declaration() end, opts)
vim.keymap.set("n", "<leader>dc", function() vim.lsp.buf.hover() end, opts) vim.keymap.set("n", "<leader>dc", function() vim.lsp.buf.hover() end, opts)
vim.keymap.set("n", "<leader>vws", function() vim.lsp.buf.workspace_symbol() end, opts) vim.keymap.set("n", "<leader>vws", function() vim.lsp.buf.workspace_symbol() end, opts)
vim.keymap.set("n", "<leader>ed", function() vim.diagnostic.open_float() end, opts) vim.keymap.set("n", "<leader>ed", function() vim.diagnostic.open_float() end, opts)

View File

@ -6,13 +6,6 @@ return {
dependencies = { 'tpope/vim-dadbod', lazy = true }, dependencies = { 'tpope/vim-dadbod', lazy = true },
lazy = true, lazy = true,
init = function() init = function()
-- vim.api.nvim_create_autocmd("FileType", {
-- pattern = {
-- "sql",
-- },
-- command = [[setlocal omnifunc=vim_dadbod_completion#omni]],
-- })
-- taken from here https://github.com/kristijanhusak/vim-dadbod-completion/issues/53#issuecomment-1902659351 -- taken from here https://github.com/kristijanhusak/vim-dadbod-completion/issues/53#issuecomment-1902659351
local autocomplete_group = vim.api.nvim_create_augroup("vimrc_autocompletion", { clear = true }) local autocomplete_group = vim.api.nvim_create_augroup("vimrc_autocompletion", { clear = true })
vim.api.nvim_create_autocmd("FileType", { vim.api.nvim_create_autocmd("FileType", {