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