Improve LSP configuration
* Add more recommended mappings * Add Python LSP support with PyRight and Ruff
This commit is contained in:
parent
4072fd3ccf
commit
378c8b0be4
@ -38,8 +38,10 @@ return {
|
|||||||
'clangd',
|
'clangd',
|
||||||
'cmake',
|
'cmake',
|
||||||
'jsonls',
|
'jsonls',
|
||||||
'lua_ls',
|
|
||||||
'lemminx',
|
'lemminx',
|
||||||
|
'lua_ls',
|
||||||
|
'pyright',
|
||||||
|
'ruff_lsp',
|
||||||
'vimls',
|
'vimls',
|
||||||
'yamlls',
|
'yamlls',
|
||||||
},
|
},
|
||||||
@ -53,8 +55,7 @@ return {
|
|||||||
|
|
||||||
['lua_ls'] = function()
|
['lua_ls'] = function()
|
||||||
require('neodev').setup()
|
require('neodev').setup()
|
||||||
local lspconfig = require('lspconfig')
|
require('lspconfig').lua_ls.setup({
|
||||||
lspconfig.lua_ls.setup({
|
|
||||||
settings = {
|
settings = {
|
||||||
Lua = {
|
Lua = {
|
||||||
diagnostics = {
|
diagnostics = {
|
||||||
@ -64,7 +65,19 @@ return {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
end
|
end,
|
||||||
|
|
||||||
|
['pyright'] = function()
|
||||||
|
require('lspconfig').pyright.setup({
|
||||||
|
settings = {
|
||||||
|
pyright = {
|
||||||
|
-- Using Ruff's import organizer
|
||||||
|
disableOrganizeImports = true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -110,13 +123,14 @@ return {
|
|||||||
vim.keymap.set('n', '<leader>fi',
|
vim.keymap.set('n', '<leader>fi',
|
||||||
require("actions-preview").code_actions, opts)
|
require("actions-preview").code_actions, opts)
|
||||||
|
|
||||||
-- Goto definition mapping
|
-- Goto mappings
|
||||||
|
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
|
||||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
|
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
|
||||||
-- TODO: nnoremap <silent> <leader>gt <Plug>(coc-type-definition)
|
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts)
|
||||||
-- TODO: nnoremap <silent> <leader>gu <Plug>(coc-references-used)
|
vim.keymap.set('n', '<leader>D', vim.lsp.buf.type_definition, opts)
|
||||||
|
|
||||||
-- Get references to symbol under cursor, store in quickfix window
|
-- Get references to symbol under cursor, store in quickfix window
|
||||||
vim.keymap.set('n', '<leader>gr', vim.lsp.buf.references, opts)
|
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
|
||||||
|
|
||||||
-- Refactoring mappings
|
-- Refactoring mappings
|
||||||
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, opts)
|
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, opts)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user