neovim

use lua/ directory to configure lsps

+57 -64
+37
candy/lsp/lua_ls.lua
··· 1 + -- Boilerplate from https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#lua_ls 2 + return { 3 + on_init = function(client) 4 + local path = client.workspace_folders[1].name 5 + if vim.loop.fs_stat(path .. "/.luarc.json") or vim.loop.fs_stat(path .. "/.luarc.jsonc") then 6 + return 7 + end 8 + 9 + client.config.settings.Lua = vim.tbl_deep_extend("force", client.config.settings.Lua, { 10 + runtime = { 11 + version = "LuaJIT", 12 + }, 13 + workspace = { 14 + checkThirdParty = false, 15 + library = { 16 + vim.env.VIMRUNTIME, 17 + -- Depending on the usage, you might want to add additional paths here. 18 + -- vim.env.LUV .. "lib/lua/5.1/", 19 + -- "${3rd}/busted/library", 20 + }, 21 + -- or pull in all of 'runtimepath'. NOTE: this is a lot slower 22 + -- library = vim.api.nvim_get_runtime_file("", true), 23 + }, 24 + }) 25 + end, 26 + settings = { 27 + Lua = { 28 + runtime = { version = "LuaJIT" }, 29 + workspace = { checkThirdParty = false }, 30 + telemetry = { enable = false }, 31 + diagnostics = { globals = { "vim" } }, 32 + completion = { 33 + callSnippet = "Replace", 34 + }, 35 + }, 36 + }, 37 + }
+12
candy/lsp/tailwindcss.lua
··· 1 + return { 2 + settings = { 3 + tailwindCSS = { 4 + experimental = { 5 + classRegex = { 6 + { "cva\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]" }, 7 + { "cx\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)" }, 8 + }, 9 + }, 10 + }, 11 + }, 12 + }
+8 -64
candy/lua/marshmallow/lsp.lua
··· 27 27 end, 28 28 }) 29 29 30 - vim.lsp.config("tailwindcss", { 31 - settings = { 32 - tailwindCSS = { 33 - experimental = { 34 - classRegex = { 35 - { "cva\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]" }, 36 - { "cx\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)" }, 37 - }, 38 - }, 39 - }, 40 - }, 41 - }) 42 - 43 - -- Boilerplate from https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#lua_ls 44 - vim.lsp.config("lua_ls", { 45 - on_init = function(client) 46 - local path = client.workspace_folders[1].name 47 - if vim.loop.fs_stat(path .. "/.luarc.json") or vim.loop.fs_stat(path .. "/.luarc.jsonc") then 48 - return 49 - end 50 - 51 - client.config.settings.Lua = vim.tbl_deep_extend("force", client.config.settings.Lua, { 52 - runtime = { 53 - version = "LuaJIT", 54 - }, 55 - workspace = { 56 - checkThirdParty = false, 57 - library = { 58 - vim.env.VIMRUNTIME, 59 - -- Depending on the usage, you might want to add additional paths here. 60 - -- vim.env.LUV .. "lib/lua/5.1/", 61 - -- "${3rd}/busted/library", 62 - }, 63 - -- or pull in all of 'runtimepath'. NOTE: this is a lot slower 64 - -- library = vim.api.nvim_get_runtime_file("", true), 65 - }, 66 - }) 67 - end, 68 - settings = { 69 - Lua = { 70 - format = { 71 - enable = false, 72 - }, 73 - runtime = { version = "LuaJIT" }, 74 - workspace = { checkThirdParty = false }, 75 - telemetry = { enable = false }, 76 - diagnostics = { globals = { "vim" } }, 77 - completion = { 78 - callSnippet = "Replace", 79 - }, 80 - }, 81 - }, 82 - }) 83 - 84 30 require("typescript-tools").setup({ 85 31 cmd = { "typescript-language-server", "--stdio" }, 86 32 settings = { ··· 101 47 }, 102 48 }) 103 49 104 - vim.lsp.enable({ 105 - "tailwindcss", 106 - "astro", 107 - "nil_ls", 108 - "gopls", 109 - "golangci_lint_ls", 110 - "pyright", 111 - "tinymist", 112 - "sourcekit", 113 - }) 50 + local lsp_configs = {} 51 + 52 + for _, f in pairs(vim.api.nvim_get_runtime_file("lsp/*.lua", true)) do 53 + local server_name = vim.fn.fnamemodify(f, ":t:r") 54 + table.insert(lsp_configs, server_name) 55 + end 56 + 57 + vim.lsp.enable(lsp_configs)