.nvim/lua/config/plugins/lsp.lua
Erica Marigold ebcb199805
Initial config divergence from luka
Minor customizations for keybinds and adds luau-lsp support.
2025-02-05 00:39:41 +05:30

120 lines
3.6 KiB
Lua

return {
{
"williamboman/mason.nvim",
opts = {},
},
{
"williamboman/mason-lspconfig.nvim",
dependencies = {
"williamboman/mason.nvim",
"neovim/nvim-lspconfig",
"saghen/blink.cmp",
},
opts = {
servers = {
lua_ls = {},
},
},
config = function(_, opts)
require("mason").setup()
require("mason-lspconfig").setup()
local lspconfig = require("lspconfig")
local function on_attach(_, buf)
local function map(keys, fn, desc)
vim.keymap.set("n", keys, fn, { buffer = buf, desc = "LSP: " .. desc })
end
map("<leader>cr", vim.lsp.buf.rename, "Rename")
map("<leader>ca", vim.lsp.buf.code_action, "Code Action")
map("gd", require("telescope.builtin").lsp_definitions, "Goto Definition")
map("gr", require("telescope.builtin").lsp_references, "Goto References")
end
for server, config in pairs(opts.servers) do
config.capabilities = require("blink.cmp").get_lsp_capabilities(config.capabilities)
config.on_attach = on_attach
lspconfig[server].setup(config)
end
end,
},
{
"saghen/blink.cmp",
version = "*",
opts = {
sources = {
default = { "lazydev", "lsp", "path", "snippets", "buffer" },
providers = {
lazydev = {
name = "LazyDev",
module = "lazydev.integrations.blink",
score_offset = 100,
},
},
},
signature = {
enabled = true,
},
keymap = {
-- ["<enter>"] = { "select_and_accept" },
["<tab>"] = {
function(cmp)
if cmp.snippet_active() then
return cmp.accept()
else
return cmp.select_and_accept()
end
end,
'snippet_forward',
'fallback'
},
["<c-enter>"] = { "show", "show_documentation", "hide_documentation" },
}
},
},
{
"folke/lazydev.nvim",
ft = "lua",
opts = {
library = {
{ path = "${3rd}/luv/library", words = { "vim%.uv" } },
},
},
},
{
"mrcjkb/rustaceanvim",
lazy = false,
},
{
"lopi-py/luau-lsp.nvim",
opts = {
server = {
settings = {
["luau-lsp"] = {
require = {
mode = "relativeToFile",
directoryAliases = {
["@lune"] = "~/.lune/.typedefs/0.8.6/",
["@lib"] = "./lib",
["@src"] = "./src",
},
},
completion = {
imports = {
enabled = true,
},
},
},
},
},
platform = {
type = "standard",
}
},
dependencies = {
"nvim-lua/plenary.nvim",
},
}
}