Dotfiles_nvim/lua/editor/language_server.lua

114 lines
2.9 KiB
Lua
Raw Permalink Normal View History

2024-09-07 15:55:27 +00:00
local TOOLCHAIN = require('toolchain')
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(
'n',
'<leader>cd',
vim.lsp.buf.hover,
{ desc = 'Show Code Definition' }
)
vim.keymap.set(
'n',
'<leader>gd',
vim.lsp.buf.definition,
{ desc = 'Go to Definition' }
)
vim.keymap.set(
'n',
'<leader>gr',
vim.lsp.buf.references,
{ desc = 'Go to References' }
)
vim.keymap.set(
'n',
'<leader>ca',
vim.lsp.buf.code_action,
{ desc = 'Do Code Actions' }
)
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(
'n',
'<leader>fc',
vim.lsp.buf.format,
{ desc = 'Format Code' }
)
end,
},
{
'nvimdev/lspsaga.nvim',
after = 'nvim-lspconfig',
dependencies = {
'nvim-treesitter/nvim-treesitter',
'nvim-tree/nvim-web-devicons',
},
config = function()
2024-09-10 07:41:43 +00:00
require('lspsaga').setup({
symbol_in_winbar = {
enable = false,
},
lightbulb = {
enable = false
}
})
2024-07-02 21:52:43 +00:00
-- Keybinding --
vim.keymap.set(
'n',
'<leader>cr',
':Lspsaga rename<CR>',
{ desc = 'Rename Variable' }
)
vim.keymap.set(
'n',
'<leader>cp',
':Lspsaga peek_definition<CR>',
{ desc = 'Peek Code Definition' }
)
end,
},
}