feat(lsp): web dev improvements
This commit is contained in:
@@ -88,6 +88,22 @@ return {
|
|||||||
enabled = false,
|
enabled = false,
|
||||||
},
|
},
|
||||||
servers = {
|
servers = {
|
||||||
|
tailwindcss = {
|
||||||
|
filetypes_exclude = { "markdown", "rust", "proto", "sh", "gitignore", "toml", "json", "fugitive" },
|
||||||
|
hovers = true,
|
||||||
|
suggestions = true,
|
||||||
|
root_dir = function(fname)
|
||||||
|
local root_pattern = require("lspconfig").util.root_pattern(
|
||||||
|
"tailwind.config.cjs",
|
||||||
|
"talwind.config.js",
|
||||||
|
"tailwind.config.ts",
|
||||||
|
"postcss.config.js",
|
||||||
|
"postcss.config.ts"
|
||||||
|
)
|
||||||
|
|
||||||
|
return root_pattern(fname)
|
||||||
|
end,
|
||||||
|
},
|
||||||
vtsls = {
|
vtsls = {
|
||||||
filetypes = {
|
filetypes = {
|
||||||
"javascript",
|
"javascript",
|
||||||
@@ -162,14 +178,25 @@ return {
|
|||||||
vim.lsp.inlay_hint.enable(true)
|
vim.lsp.inlay_hint.enable(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
if client ~= nil and client.name == "svelte" then
|
if client ~= nil then
|
||||||
vim.api.nvim_create_autocmd("BufWritePost", {
|
if client.name == "svelte" then
|
||||||
pattern = { "*.svelte", "*.js", "*.ts" },
|
vim.api.nvim_create_autocmd("BufWritePost", {
|
||||||
group = vim.api.nvim_create_augroup("svelte_ondidchangetsorjsfile", { clear = true }),
|
pattern = { "*.svelte", "*.js", "*.ts" },
|
||||||
callback = function(ctx)
|
group = vim.api.nvim_create_augroup("svelte_ondidchangetsorjsfile", { clear = true }),
|
||||||
client.notify("$/onDidChangeTsOrJsFile", { uri = ctx.match })
|
callback = function(ctx)
|
||||||
end,
|
client.notify("$/onDidChangeTsOrJsFile", { uri = ctx.match })
|
||||||
})
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
if vim.bo[buffer].filetype == "svelte" then
|
||||||
|
vim.api.nvim_create_autocmd("BufWritePost", {
|
||||||
|
pattern = { "*.svelte", "*.js", "*.ts" },
|
||||||
|
callback = function(ctx)
|
||||||
|
client.notify("$/onDidChangeTsOrJsFile", { uri = ctx.match })
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user