mirror of
https://github.com/LunarVim/LunarVim.git
synced 2025-08-01 16:45:00 +02:00
tailwindcss LSP fix (#442)
This commit is contained in:
parent
66501fefe7
commit
04c21be64b
1 changed files with 12 additions and 7 deletions
|
@ -1,21 +1,26 @@
|
|||
local lspconfig = require 'lspconfig'
|
||||
local configs = require 'lspconfig/configs'
|
||||
local util = require"lspconfig".util
|
||||
|
||||
-- Check if tailwindls server already defined.
|
||||
if not lspconfig.tailwindls then configs['tailwindls'] = {default_config = {}} end
|
||||
|
||||
lspconfig.tailwindls.setup {
|
||||
cmd = {
|
||||
"node", DATA_PATH .. "/lspinstall/tailwindcss/tailwindcss-intellisense/extension/dist/server/index.js",
|
||||
"node", DATA_PATH .. "/lspinstall/tailwindcss/tailwindcss-intellisense/extension/dist/server/tailwindServer.js",
|
||||
"--stdio"
|
||||
},
|
||||
filetypes = O.tailwindls.filetypes,
|
||||
root_dir = require('lspconfig/util').root_pattern("package.json", "tsconfig.json", "jsconfig.json", ".git"),
|
||||
handlers = {
|
||||
["tailwindcss/getConfiguration"] = function(_, _, params, _, bufnr, _)
|
||||
-- tailwindcss lang server waits for this repsonse before providing hover
|
||||
vim.lsp.buf_notify(bufnr, "tailwindcss/getConfigurationResponse", {_id = params._id})
|
||||
end
|
||||
init_options = {
|
||||
userLanguages = { -- I don't know why but the LSP won't autocomplete the tailwind classes without this
|
||||
}
|
||||
},
|
||||
root_dir = function(fname)
|
||||
return util.root_pattern('tailwind.config.js', 'tailwind.config.ts')(fname) or
|
||||
util.root_pattern('postcss.config.js', 'postcss.config.ts')(fname) or
|
||||
util.find_package_json_ancestor(fname) or
|
||||
util.find_node_modules_ancestor(fname) or
|
||||
util.find_git_ancestor(fname)
|
||||
end,
|
||||
on_attach = require'lsp'.common_on_attach
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue