LSP Integration

Integrated LSP functionality into neovim configurations. Installed
Mason to manage the installation of language servers. Used
mason-lspconfig for the bridge between Mason and nvim-lspconfig.
Also installed telescope-ui-select plugin to telescope to allow it
to use telescope and it's windows for code actions.
This commit is contained in:
2024-08-04 21:03:03 -04:00
parent d5d5c11767
commit 72fef12c29
3 changed files with 81 additions and 8 deletions

View File

@@ -0,0 +1,39 @@
return {
{
"williamboman/mason.nvim",
config = function ()
require("mason").setup()
end
},
{
"williamboman/mason-lspconfig.nvim",
config = function ()
require("mason-lspconfig").setup({
ensure_installed = {
"clangd",
"cmake",
"lua_ls",
"pyright",
"rust_analyzer",
"taplo",
}
})
end
},
{
"neovim/nvim-lspconfig",
config = function()
local lspconfig = require("lspconfig")
lspconfig.clangd.setup({})
lspconfig.cmake.setup({})
lspconfig.lua_ls.setup({})
lspconfig.pyright.setup({})
lspconfig.rust_analyzer.setup({})
lspconfig.taplo.setup({})
vim.keymap.set('n', 'K', vim.lsp.buf.hover, {})
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, {})
vim.keymap.set('n', '<leader>ca', vim.lsp.buf.code_action, {})
end
},
}

View File

@@ -1,10 +1,43 @@
return {
'nvim-telescope/telescope.nvim',
branch = '0.1.x',
dependencies = { 'nvim-lua/plenary.nvim' },
config = function()
local builtin = require('telescope.builtin')
vim.keymap.set('n', '<C-p>', builtin.find_files, {})
vim.keymap.set('n', '<leader>fg', builtin.live_grep, {})
end
{
'nvim-telescope/telescope.nvim',
branch = '0.1.x',
dependencies = { 'nvim-lua/plenary.nvim' },
config = function()
local builtin = require('telescope.builtin')
vim.keymap.set('n', '<C-p>', builtin.find_files, {})
vim.keymap.set('n', '<leader>fg', builtin.live_grep, {})
end
},
{
'nvim-telescope/telescope-ui-select.nvim',
config = function ()
-- This is your opts table
require("telescope").setup {
extensions = {
["ui-select"] = {
require("telescope.themes").get_dropdown {
-- even more opts
}
-- pseudo code / specification for writing custom displays, like the one
-- for "codeactions"
-- specific_opts = {
-- [kind] = {
-- make_indexed = function(items) -> indexed_items, width,
-- make_displayer = function(widths) -> displayer
-- make_display = function(displayer) -> function(e)
-- make_ordinal = function(e) -> string
-- },
-- -- for example to disable the custom builtin "codeactions" display
-- do the following
-- codeactions = false,
-- }
}
}
}
-- To get ui-select loaded and working with telescope, you need to call
-- load_extension, somewhere after setup function:
require("telescope").load_extension("ui-select")
end
}
}