updated lsp version, added copy to clipboard keybind

This commit is contained in:
2025-05-23 23:34:29 +05:00
parent 97e5f06a61
commit c42731619c
12 changed files with 65 additions and 304 deletions

View File

@ -1,65 +1,48 @@
local mason_lspconfig = require("mason-lspconfig")
local navic = require("nvim-navic")
mason_lspconfig.setup_handlers({
-- The first entry (without a key) will be the default handler
-- and will be called for each installed server that doesn't have
-- a dedicated handler.
["omnisharp"] = function()
require("lspconfig")["omnisharp"].setup({
on_attach = function(client, bufnr)
if client.name == "omnisharp" then
client.server_capabilities.semanticTokensProvider = nil
navic.attach(client, bufnr)
end
end,
})
end,
["pylsp"] = function()
require("lspconfig")["pylsp"].setup({
on_attach = function(client, bufnr)
navic.attach(client, bufnr)
end,
settings = {
pylsp = {
plugins = {
pycodestyle = {
ignore = { "E501", "E231", "W503" },
maxLineLength = 100,
},
},
},
},
})
end,
["rust_analyzer"] = function()
require("lspconfig")["rust_analyzer"].setup({
on_attach = function(client, bufnr)
navic.attach(client, bufnr)
end,
settings = {
["rust-analyzer"] = {
cargo = {
allFeatures = true,
},
},
},
})
end,
function(server_name) -- default handler (optional)
require("lspconfig")[server_name].setup({
on_attach = function(client, bufnr)
navic.attach(client, bufnr)
end,
})
end,
-- ["omnisharp"] = function()
-- require("omnisharp").setup({})
-- end,
-- Next, you can provide a dedicated handler for specific servers.
-- For example, a handler override for the `rust_analyzer`:
-- ["rust_analyzer"] = function()
-- require("rust-tools").setup({})
-- end,
vim.lsp.enable({
"omnisharp",
"pylsp",
"rust_analyzer",
})
-- TODO: this does not work, need to install pylsp-mypy plugin manually
local function extra_args()
local virtual = os.getenv("VIRTUAL_ENV") or "/usr"
return { "--python-executable", virtual .. "/bin/python3", true }
end
vim.lsp.config('pylsp', {
settings = {
["pylsp"] = {
enabled = true,
plugins = {
pycodestyle = {
ignore = { "E501", "E231", "W503" },
maxLineLength = 100,
},
pyls_isort = { enabled = true },
pylsp_mypy = {
enabled = true,
-- this will make mypy to use the virtual environment
-- if not activated then it will use the system python(more specifically /usr/bin/python3)
overrides = extra_args(),
report_progress = true,
live_mode = true,
},
},
}
}
})
vim.lsp.config('rust_analyzer', {
settings = {
["rust-analyzer"] = {
cargo = {
allFeatures = true,
},
},
}
})
mason_lspconfig.setup()