Skip to content

Commit

Permalink
Add lspsaga and configure it with our current lsp setup
Browse files Browse the repository at this point in the history
  • Loading branch information
cpow committed Jan 6, 2023
1 parent 0034c19 commit bac24bd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
28 changes: 16 additions & 12 deletions lua/core/plugin_config/lsp_config.lua
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
require("mason").setup()
require("mason-lspconfig").setup({
ensure_installed = { "sumneko_lua", "solargraph" }
})

local on_attach = function(_, _)
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, {})
vim.keymap.set('n', '<leader>ca', vim.lsp.buf.code_action, {})
local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities())

vim.keymap.set('n', 'gd', vim.lsp.buf.definition, {})
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, {})
vim.keymap.set('n', 'gr', require('telescope.builtin').lsp_references, {})
vim.keymap.set('n', 'K', vim.lsp.buf.hover, {})
end
local saga = require 'lspsaga'
saga.init_lsp_saga({
code_action_icon = "💡",
symbol_in_winbar = {
in_custom = false,
enable = true,
separator = '',
show_file = true,
file_formatter = ""
},
})

local capabilities = require('cmp_nvim_lsp').default_capabilities()
vim.keymap.set("n", "gd", "<cmd>Lspsaga lsp_finder<CR>", { silent = true })
vim.keymap.set('n', 'K', '<Cmd>Lspsaga hover_doc<cr>', { silent = true })
vim.keymap.set({"n","v"}, "<leader>ca", "<cmd>Lspsaga code_action<CR>", { silent = true })
vim.keymap.set("n", "<leader>rn", "<cmd>Lspsaga rename<CR>", { silent = true })

require("lspconfig").sumneko_lua.setup {
on_attach = on_attach,
capabilities = capabilities,
settings = {
Lua = {
Expand All @@ -34,6 +39,5 @@ require("lspconfig").sumneko_lua.setup {
}

require("lspconfig").solargraph.setup {
on_attach = on_attach,
capabilities = capabilities,
}
2 changes: 2 additions & 0 deletions lua/core/plugins.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ return require('packer').startup(function(use)
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
"neovim/nvim-lspconfig",
"glepnir/lspsaga.nvim",
}

use {
'nvim-telescope/telescope.nvim',
tag = '0.1.0',
Expand Down

0 comments on commit bac24bd

Please sign in to comment.