diff options
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/lsp/tailwindcss-ls.lua | 21 | ||||
| -rw-r--r-- | lua/nv-globals.lua | 3 | 
2 files changed, 24 insertions, 0 deletions
| diff --git a/lua/lsp/tailwindcss-ls.lua b/lua/lsp/tailwindcss-ls.lua new file mode 100644 index 00000000..0bc5d80a --- /dev/null +++ b/lua/lsp/tailwindcss-ls.lua @@ -0,0 +1,21 @@ +local lspconfig = require 'lspconfig' +local configs = require 'lspconfig/configs' + +-- 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", +        "--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 +    }, +    on_attach = require'lsp'.common_on_attach +} diff --git a/lua/nv-globals.lua b/lua/nv-globals.lua index 4c18a6e1..36c92c23 100644 --- a/lua/nv-globals.lua +++ b/lua/nv-globals.lua @@ -46,6 +46,9 @@ O = {          formatter = '',          autoformat = false,          diagnostics = {virtual_text = true, signs = true, underline = true} +    }, +    tailwindls = { +        filetypes = {'html', 'css', 'scss', 'javascript', 'javascriptreact', 'typescript', 'typescriptreact'}      }      -- css = {formatter = '', autoformat = false, virtual_text = true},      -- json = {formatter = '', autoformat = false, virtual_text = true} | 
