diff --git a/lua/plugins/lsp/init.lua b/lua/plugins/lsp/init.lua index baf70d3..595d25a 100644 --- a/lua/plugins/lsp/init.lua +++ b/lua/plugins/lsp/init.lua @@ -1,34 +1,34 @@ -local M = { - "neovim/nvim-lspconfig", - init = function() - require("core.utils").lazy_load("nvim-lspconfig") - end, - config = function() - local LspM = require("plugins.lsp.module") - - require("plugins.lsp.setup") - require("plugins.lsp.setup-lua") - - -- remmember mason ensure installed - local languages = { - -- frontend - "html", - "cssls", - "tsserver", - "angularls", - "tailwindcss", - - -- rust & c/c++ - "rust_analyzer", - "clangd", - } - for _, lsp in ipairs(languages) do - require("lspconfig")[lsp].setup({ - on_attach = LspM.on_attach, - capabilities = LspM.capabilities, - }) - end - end, -} - -return M +local M = { + "neovim/nvim-lspconfig", + init = function() + require("core.utils").lazy_load("nvim-lspconfig") + end, + config = function() + local LspM = require("plugins.lsp.module") + + require("plugins.lsp.setup") + require("plugins.lsp.lua").setup() + + -- remmember mason ensure installed + local languages = { + -- frontend + "html", + "cssls", + "tsserver", + "angularls", + "tailwindcss", + + -- rust & c/c++ + "rust_analyzer", + "clangd", + } + for _, lsp in ipairs(languages) do + require("lspconfig")[lsp].setup({ + on_attach = LspM.on_attach, + capabilities = LspM.capabilities, + }) + end + end, +} + +return M diff --git a/lua/plugins/lsp/lua/init.lua b/lua/plugins/lsp/lua/init.lua new file mode 100644 index 0000000..c6bf129 --- /dev/null +++ b/lua/plugins/lsp/lua/init.lua @@ -0,0 +1,32 @@ +local M = { + setup = function () + local lsp = require("plugins.lsp.module") + + require("lspconfig").lua_ls.setup({ + on_attach = lsp.on_attach, + capabilities = lsp.capabilities, + + settings = { + Lua = { + diagnostics = { + globals = { "vim" }, + }, + workspace = { + library = { + [vim.fn.expand("$VIMRUNTIME/lua")] = true, + [vim.fn.expand("$VIMRUNTIME/lua/vim/lsp")] = true, + [vim.fn.stdpath("data") .. "/lazy/ui/nvchad_types"] = true, + [vim.fn.stdpath("data") .. "/lazy/lazy.nvim/lua/lazy"] = true, + }, + maxPreload = 100000, + ereloadFileSize = 10000, + }, + format = { + enable = true, + } + }, + }, + }) + end +} +return M diff --git a/lua/plugins/lsp/setup-lua.lua b/lua/plugins/lsp/setup-lua.lua deleted file mode 100644 index d0af73b..0000000 --- a/lua/plugins/lsp/setup-lua.lua +++ /dev/null @@ -1,24 +0,0 @@ -local M = require("plugins.lsp.module") - -require("lspconfig").lua_ls.setup({ - on_attach = M.on_attach, - capabilities = M.capabilities, - - settings = { - Lua = { - diagnostics = { - globals = { "vim" }, - }, - workspace = { - library = { - [vim.fn.expand("$VIMRUNTIME/lua")] = true, - [vim.fn.expand("$VIMRUNTIME/lua/vim/lsp")] = true, - [vim.fn.stdpath("data") .. "/lazy/ui/nvchad_types"] = true, - [vim.fn.stdpath("data") .. "/lazy/lazy.nvim/lua/lazy"] = true, - }, - maxPreload = 100000, - preloadFileSize = 10000, - }, - }, - }, -})