Skip to content

Commit

Permalink
chore lua setup
Browse files Browse the repository at this point in the history
  • Loading branch information
aolyang committed Dec 15, 2023
1 parent 430fee0 commit c78b376
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 58 deletions.
68 changes: 34 additions & 34 deletions lua/plugins/lsp/init.lua
Original file line number Diff line number Diff line change
@@ -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
32 changes: 32 additions & 0 deletions lua/plugins/lsp/lua/init.lua
Original file line number Diff line number Diff line change
@@ -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
24 changes: 0 additions & 24 deletions lua/plugins/lsp/setup-lua.lua

This file was deleted.

0 comments on commit c78b376

Please sign in to comment.