mirror of
https://github.com/tjdevries/advent-of-nvim.git
synced 2025-12-14 21:21:16 +00:00
38 lines
997 B
Lua
38 lines
997 B
Lua
return {
|
|
{
|
|
"neovim/nvim-lspconfig",
|
|
dependencies = {
|
|
'saghen/blink.cmp',
|
|
{
|
|
"folke/lazydev.nvim",
|
|
opts = {
|
|
library = {
|
|
{ path = "${3rd}/luv/library", words = { "vim%.uv" } },
|
|
},
|
|
},
|
|
},
|
|
},
|
|
config = function()
|
|
local capabilities = require('blink.cmp').get_lsp_capabilities()
|
|
require("lspconfig").lua_ls.setup { capabilites = capabilities }
|
|
|
|
vim.api.nvim_create_autocmd('LspAttach', {
|
|
callback = function(args)
|
|
local c = vim.lsp.get_client_by_id(args.data.client_id)
|
|
if not c then return end
|
|
|
|
if vim.bo.filetype == "lua" then
|
|
-- Format the current buffer on save
|
|
vim.api.nvim_create_autocmd('BufWritePre', {
|
|
buffer = args.buf,
|
|
callback = function()
|
|
vim.lsp.buf.format({ bufnr = args.buf, id = c.id })
|
|
end,
|
|
})
|
|
end
|
|
end,
|
|
})
|
|
end,
|
|
}
|
|
}
|