This commit is contained in:
2025-09-05 20:46:41 -04:00
commit 5d95db3480
18 changed files with 481 additions and 0 deletions

View File

@@ -0,0 +1,92 @@
return {
-- LSP Configuration
{
"neovim/nvim-lspconfig",
dependencies = {
-- LSP Management
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
-- Optional but recommended
"hrsh7th/nvim-cmp", -- Completion engine
"hrsh7th/cmp-nvim-lsp", -- LSP source for nvim-cmp
"j-hui/fidget.nvim", -- LSP status updates
"folke/neodev.nvim", -- Additional Lua configuration
},
config = function()
-- Setup language servers
local lspconfig = require("lspconfig")
local capabilities = require("cmp_nvim_lsp").default_capabilities()
-- Configure each language server
lspconfig.lua_ls.setup({
capabilities = capabilities,
settings = {
Lua = {
diagnostics = {
globals = { "vim" },
},
workspace = {
library = vim.api.nvim_get_runtime_file("", true),
checkThirdParty = false,
},
telemetry = {
enable = false,
},
},
},
})
-- Add more language servers
lspconfig.pyright.setup({
capabilities = capabilities,
})
-- Add keybindings for LSP functions
vim.api.nvim_create_autocmd("LspAttach", {
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
callback = function(ev)
local opts = { buffer = ev.buf, noremap = true, silent = true }
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts)
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, opts)
vim.keymap.set("n", "gr", vim.lsp.buf.references, opts)
vim.keymap.set("n", "<leader>f", function()
vim.lsp.buf.format({ async = true })
end, opts)
end,
})
end,
},
{
"williamboman/mason.nvim",
config = function()
require("mason").setup()
end,
},
{
"williamboman/mason-lspconfig.nvim",
config = function()
require("mason-lspconfig").setup({
ensure_installed = {
-- Add the language servers you want to auto-install
"lua_ls",
"pyright",
"ts_ls"
},
})
end,
},
-- Optional: Add nvim-cmp and its sources
{
"hrsh7th/nvim-cmp",
dependencies = {
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
-- Add other sources as needed
},
},
}