1
0
Fork 1
Dotfiles_nvim/lua/editor/language_server.lua

115 lines
3.3 KiB
Lua
Raw Normal View History

2024-09-07 15:55:27 +00:00
local TOOLCHAIN = require('toolchain')
2024-11-23 16:55:23 +00:00
local K = require('core.keymap')
2024-07-02 21:52:43 +00:00
return {
{
'williamboman/mason.nvim',
lazy = false,
config = function() require('mason').setup() end,
},
{
'williamboman/mason-lspconfig.nvim',
lazy = false,
opts = {
auto_install = true,
},
config = function()
require('mason-lspconfig').setup({
2024-09-07 18:39:22 +00:00
ensure_installed = TOOLCHAIN.get_lsp_autoinstalls(),
2024-07-02 21:52:43 +00:00
})
end,
},
{
'neovim/nvim-lspconfig',
lazy = false,
config = function()
-- Setup --
local capabilities = require('cmp_nvim_lsp').default_capabilities()
local lspconfig = require('lspconfig')
2024-09-07 18:39:22 +00:00
TOOLCHAIN.setup_lsps(lspconfig, capabilities)
2024-07-02 21:52:43 +00:00
-- Keybinding --
vim.keymap.set(
2024-11-23 16:55:23 +00:00
K.CODE.SHOW_DEFINITION.mode,
K.CODE.SHOW_DEFINITION.shortcut,
2024-07-02 21:52:43 +00:00
vim.lsp.buf.hover,
2024-11-23 16:55:23 +00:00
{ desc = K.CODE.SHOW_DEFINITION.description }
2024-07-02 21:52:43 +00:00
)
vim.keymap.set(
2024-11-23 16:55:23 +00:00
K.CODE.GOTO_DEFINITION.mode,
K.CODE.GOTO_DEFINITION.shortcut,
2024-07-02 21:52:43 +00:00
vim.lsp.buf.definition,
2024-11-23 16:55:23 +00:00
{ desc = K.CODE.GOTO_DEFINITION.description }
2024-07-02 21:52:43 +00:00
)
vim.keymap.set(
2024-11-23 16:55:23 +00:00
K.CODE.GOTO_REFERENCES.mode,
K.CODE.GOTO_REFERENCES.shortcut,
2024-07-02 21:52:43 +00:00
vim.lsp.buf.references,
2024-11-23 16:55:23 +00:00
{ desc = K.CODE.GOTO_REFERENCES.description }
2024-07-02 21:52:43 +00:00
)
vim.keymap.set(
2024-11-23 16:55:23 +00:00
K.CODE.ACTIONS.mode,
K.CODE.ACTIONS.shortcut,
2024-07-02 21:52:43 +00:00
vim.lsp.buf.code_action,
2024-11-23 16:55:23 +00:00
{ desc = K.CODE.ACTIONS.description }
2024-07-02 21:52:43 +00:00
)
end,
},
{
'nvimtools/none-ls.nvim',
dependencies = {
'nvim-lua/plenary.nvim',
'nvimtools/none-ls-extras.nvim',
},
config = function()
-- Setup --
local null_ls = require('null-ls')
null_ls.setup({
2024-09-07 18:39:22 +00:00
sources = TOOLCHAIN.get_null_ls_source(null_ls),
2024-07-02 21:52:43 +00:00
})
-- Keybinding --
vim.keymap.set(
2024-11-23 16:55:23 +00:00
K.CODE.FORMAT.mode,
K.CODE.FORMAT.shortcut,
2024-07-02 21:52:43 +00:00
vim.lsp.buf.format,
2024-11-23 16:55:23 +00:00
{ desc = K.CODE.FORMAT.description }
2024-07-02 21:52:43 +00:00
)
end,
},
{
'nvimdev/lspsaga.nvim',
after = 'nvim-lspconfig',
dependencies = {
'nvim-treesitter/nvim-treesitter',
'nvim-tree/nvim-web-devicons',
},
config = function()
2024-10-11 22:09:33 +00:00
require('lspsaga').setup({
symbol_in_winbar = {
2024-11-23 16:55:23 +00:00
enable = false,
2024-10-11 22:09:33 +00:00
},
lightbulb = {
2024-11-23 16:55:23 +00:00
enable = false,
},
2024-10-11 22:09:33 +00:00
})
2024-07-02 21:52:43 +00:00
-- Keybinding --
vim.keymap.set(
2024-11-23 16:55:23 +00:00
K.CODE.RENAME.mode,
K.CODE.RENAME.shortcut,
2024-07-02 21:52:43 +00:00
':Lspsaga rename<CR>',
2024-11-23 16:55:23 +00:00
{ desc = K.CODE.RENAME.description }
2024-07-02 21:52:43 +00:00
)
vim.keymap.set(
2024-11-23 16:55:23 +00:00
K.CODE.PEEK_DEFINITION.mode,
K.CODE.PEEK_DEFINITION.shortcut,
2024-07-02 21:52:43 +00:00
':Lspsaga peek_definition<CR>',
2024-11-23 16:55:23 +00:00
{ desc = K.CODE.PEEK_DEFINITION.description }
2024-07-02 21:52:43 +00:00
)
end,
},
}