mirror of
https://github.com/tjdevries/advent-of-nvim.git
synced 2025-12-16 06:01:15 +00:00
sorry, i forgot to update this more regularly
This commit is contained in:
37
nvim/lua/config/plugins/lsp.lua
Normal file
37
nvim/lua/config/plugins/lsp.lua
Normal file
@@ -0,0 +1,37 @@
|
||||
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,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user