aboutsummaryrefslogtreecommitdiffstats
path: root/nvim
diff options
context:
space:
mode:
Diffstat (limited to 'nvim')
-rw-r--r--nvim/lua/keymap.lua1
-rw-r--r--nvim/lua/plugins/lsp.lua61
2 files changed, 53 insertions, 9 deletions
diff --git a/nvim/lua/keymap.lua b/nvim/lua/keymap.lua
index b816776..5fff17b 100644
--- a/nvim/lua/keymap.lua
+++ b/nvim/lua/keymap.lua
@@ -11,6 +11,7 @@ end
vim.keymap.set('n', 'gf', function() cmd_pcall(':e <cfile>') end, {noremap = true})
vim.keymap.set('n', "<Leader>q", function() vim.cmd(':botright cope') end)
vim.keymap.set('n', "<Leader>l", function() cmd_pcall(':aboveleft lope') end)
+vim.keymap.set('n', "<Leader>dk", function () vim.diagnostic.open_float() end)
vim.keymap.set('n',"<Leader>k", function() vim.cmd("make") end)
diff --git a/nvim/lua/plugins/lsp.lua b/nvim/lua/plugins/lsp.lua
index 217802a..b0b1ac6 100644
--- a/nvim/lua/plugins/lsp.lua
+++ b/nvim/lua/plugins/lsp.lua
@@ -3,8 +3,24 @@ local lspconfig = {
lazy = false,
dependencies = {
'williamboman/mason.nvim',
- 'williamboman/mason-lspconfig'
+ 'williamboman/mason-lspconfig.nvim'
},
+ config = function()
+ vim.api.nvim_create_autocmd("LspAttach", {
+ group = vim.api.nvim_create_augroup('lsp_attach_disable_ruff_hover', { clear = true }),
+ callback = function(args)
+ local client = vim.lsp.get_client_by_id(args.data.client_id)
+ if client == nil then
+ return
+ end
+ if client.name == 'ruff' then
+ -- Disable hover in favor of BasedPyright
+ client.server_capabilities.hoverProvider = false
+ end
+ end,
+ desc = 'LSP: Disable hover capability from Ruff',
+ })
+ end,
keys = {
{
'gd',
@@ -16,7 +32,7 @@ local lspconfig = {
},
{
'<leader>r',
- function ()
+ function()
vim.lsp.buf.rename()
end,
mode = 'n',
@@ -27,20 +43,20 @@ local lspconfig = {
function()
vim.lsp.buf.format()
end,
- mode = {'n', 'v'},
+ mode = { 'n', 'v' },
desc = "Format code"
},
{
'<leader>la',
- function ()
+ function()
vim.lsp.buf.code_action()
end,
- mode = {'n', 's'},
+ mode = { 'n', 's' },
desc = "Show code actions"
},
{
'<leader>lr',
- function ()
+ function()
vim.lsp.buf.references()
end,
mode = 'n',
@@ -48,7 +64,7 @@ local lspconfig = {
},
{
'<C-h>',
- function ()
+ function()
vim.lsp.buf.signature_help()
end,
mode = 'i',
@@ -59,7 +75,8 @@ local lspconfig = {
local mason = {
'williamboman/mason.nvim',
- opts = {}
+ opts = {},
+ build = ":MasonUpdate"
}
local mason_lspconfig = {
@@ -68,12 +85,22 @@ local mason_lspconfig = {
'williamboman/mason.nvim',
},
opts = {
+ ensure_installed = {
+ "basedpyright",
+ "clangd",
+ "cssls",
+ "gopls",
+ "html",
+ "ruff",
+ "tsserver"
+
+ },
handlers = {
function(server_name)
require('lspconfig')[server_name].setup({})
end
},
- ["lua_ls"] = function ()
+ ["lua_ls"] = function()
require('lspconfig').lua_ls.setup({
settings = {
Lua = {
@@ -83,6 +110,22 @@ local mason_lspconfig = {
}
}
})
+ end,
+ ["basedpyright"] = function()
+ require('lspconfig').setup({
+ settings = {
+ pyright = {
+ -- defer to ruff for import oranization
+ disableOrganizeImports = true,
+ },
+ python = {
+ analysis = {
+ -- Ignore all files for analysis to exclusively use Ruff for linting
+ ignore = { '*' },
+ },
+ },
+ },
+ })
end
}
}