coc-tailwindcss3
fork from a vscode-tailwindcss
Intelligent Tailwind CSS tooling for coc.nvim.
Motivation
There are two coc.nvim extensions to "tailwindcss". Unfortunately, neither is currently maintained and will not work with "tailwindcss3"...
I have created @yaegassy/coc-tailwindcss3
which supports "tailwindcss3".
Install
CocInstall:
:CocInstall @yaegassy/coc-tailwindcss3
scoped packages
vim-plug:
Plug 'yaegassy/coc-tailwindcss3', {'do': 'yarn install --frozen-lockfile'}
Prepare
Create tailwindCSS configuration in your project.
this extension need the configuration exists in your project
npx tailwindcss init
Configuration options
tailwindCSS.enable
: Enable coc-tailwindcss3 extension, default:true
tailwindCSS.trace.server
: Trace level of tailwindCSS language server, default:off
tailwindCSS.custom.serverPath
: Custom path to server module. If there is no setting, the built-in module will be used, default:""
tailwindCSS.emmetCompletions
: Enable class name completions when using Emmet-style syntax, for examplediv.bg-red-500.uppercase
, default:false
tailwindCSS.includeLanguages
: Enable features in languages that are not supported by default. Add a mapping here between the new language and an already supported language. E.g.:{"plaintext": "html"}
, default:{ "eelixir": "html", "elixir": "html", "eruby": "html", "htmldjango": "html", "html.twig": "html" }
tailwindCSS.files.exclude
: Configure glob patterns to exclude from all IntelliSense features. Inherits all glob patterns from the#files.exclude#
setting, default: ["/.git/", "/node_modules/", "/.hg/"]tailwindCSS.classAttributes
: The HTML attributes for which to provide class completions, hover previews, linting etc, default:["class", "className", "ngClass"]
tailwindCSS.validate
: Enable linting. Rules can be configured individually using thetailwindcss.lint.*
settings, default:true
tailwindCSS.lint.cssConflict
: Class names on the same HTML element which apply the same CSS property or properties, valid option ["ignore", "warning", "error"], default:warning
tailwindCSS.lint.invalidApply
: Unsupported use of the@apply
directive, valid option ["ignore", "warning", "error"], default:error
tailwindCSS.lint.invalidScreen
: Unknown screen name used with the@screen
directive, valid option ["ignore", "warning", "error"], default:error
tailwindCSS.lint.invalidVariant
: Unknown variant name used with the@variants
directive, valid option ["ignore", "warning", "error"], default:error
tailwindCSS.lint.invalidConfigPath
: Unknown or invalid path used with thetheme
helper, valid option ["ignore", "warning", "error"], default:error
tailwindCSS.lint.invalidTailwindDirective
: Unknown value used with the@tailwind
directive, valid option ["ignore", "warning", "error"], default:error
tailwindCSS.lint.recommendedVariantOrder
: Class variants not in the recommended order (applies in JIT mode only), valid option ["ignore", "warning", "error"], default:error
tailwindCSS.inspectPort
: Enable the Node.js inspector agent for the language server and listen on the specified port, default:null
Commands
tailwindCSS.showOutput
: Tailwind CSS: Show Output
Custom Server Path
tailwindCSS.custom.serverPath: Custom path to server module. If there is no setting, the built-in module will be used, default: ""
This setting allows you to use the tailwind's language server module installed in any location.
Usage Example 1 (vsix)
prepare:
mkdir -p /tmp/tailwindcss-language-server
cd /tmp/tailwindcss-language-server
curl -LO https://github.com/tailwindlabs/tailwindcss-intellisense/releases/download/v0.8.1/vscode-tailwindcss-0.8.1.vsix
unzip vscode-tailwindcss-0.8.1.vsix
setting:
{
"tailwindCSS.custom.serverPath": "/tmp/tailwindcss-language-server/extension/dist/server/tailwindServer.js"
}
Usage Example 2 (Use extensions installed in VSCode)
setting:
{
"tailwindCSS.custom.serverPath": "/path/to/.vscode/extensions/bradlc.vscode-tailwindcss-0.8.1/dist/tailwindServer.js
}
Usage Example 3 (npm)
prepare:
npm i -g @tailwindcss/[email protected]
setting:
{
"tailwindCSS.custom.serverPath": "/path/to/.nvm/versions/node/v16.14.2/bin/tailwindcss-language-server"
}
Thanks
License
MIT
This extension is built with create-coc-extension