Tailwind CSS IntelliSense
fork from vscode-tailwindcss v0.2.0
Tailwind CSS class name completion for coc.nvim
Install
CocInstall coc-tailwindcss
or with vim-plug, in your .vimrc
/init.vim
inside the plug#begin/end
block:
Plug 'iamcco/coc-tailwindcss', {'do': 'yarn install --frozen-lockfile && yarn run build'}
Create tailwindCSS configuration in your project
this extension need the configuration exists in your project
tailwind init
Settings
-
tailwindCSS.trace.server
Trace level of tailwindCSS language server, default:off
-
tailwindCSS.emmetCompletions
Enable class name completions for Emmet-style syntax, default:false
-
tailwindCSS.cssLanguages
css languages completion support, default:[ "css", "less", "postcss", "sass", "scss", "stylus", "vue" ]
-
tailwindCSS.jsLanguages
javascript languages completion support, default:[ "javascript", "javascriptreact", "reason", "typescriptreact" ]
-
tailwindCSS.htmlLanguages
html languages completion support, default:[ "blade", "edge", "eelixir", "ejs", "elixir", "elm", "erb", "eruby", "haml", "handlebars", "htmldjango", "html", "HTML (EEx)", "HTML (Eex)", "html.twig", "jade", "leaf", "markdown", "njk", "nunjucks", "php", "razor", "slim", "svelte", "twig", "vue" ]
Features
Tailwind CSS IntelliSense uses your projects Tailwind installation and configuration to provide suggestions as you type.
HTML (including Vue, JSX, PHP etc.)
- Class name suggestions
- Suggestions include color previews where applicable, for example for text and background colors
- They also include a preview of the actual CSS for that class name
- CSS preview when hovering over class names
CSS
- Suggestions when using
@apply
andconfig()
- Suggestions when using the
@screen
directive - Improves syntax highlighting when using
@apply
andconfig()
Headwind
fork from headwind
Headwind is an opinionated Tailwind CSS class sorter for coc.nvim. It enforces consistent ordering of classes by parsing your code and reprinting class tags to follow a given order.
Headwind runs on save, will remove duplicate classes and can even sort entire workspaces.
Usage
You can trigger Headwind by:
Commands
tailwindCSS.headwind.sortTailwindClasses
Sort Tailwind CSS ClassestailwindCSS.headwind.sortTailwindClassesOnWorkspace
Sort Tailwind CSS Classes on Entire Workspace
Headwind can sort individual files by running tailwindCSS.headwind.sortTailwindClasses
via the Command Palette. Workspaces can also be sorted by running tailwindCSS.headwind.sortTailwindClassesOnWorkspace
.
Any breakpoints or unknown classes will be moved to the end of the class list, whilst duplicate classes will be removed.
Customisation
Headwind ships with a default class order (located in package.json). You can edit this (and other settings) to your liking on the extension settings page.
tailwindCSS.headwind.classRegex
:
An object with language IDs as keys and their values determining the regex to search for Tailwind CSS classes. The default is located in package.json but this can be customized to suit your needs.
There can be multiple capturing groups, that should only contain a string with Tailwind CSS classes (without any apostrophies etc.). If a new group, which doesn't contain the class
string, is created, ensure that it is non-capturing by using (?:)
.
Example from package.json
:
"tailwindCSS.headwind.classRegex": {
"html": "\\bclass\\s*=\\s*[\\\"\\']([_a-zA-Z0-9\\s\\-\\:\\/]+)[\\\"\\']",
"javascriptreact": "(?:\\bclassName\\s*=\\s*[\\\"\\']([_a-zA-Z0-9\\s\\-\\:\\/]+)[\\\"\\'])|(?:\\btw\\s*`([_a-zA-Z0-9\\s\\-\\:\\/]*)`)"
}
tailwindCSS.headwind.sortTailwindClasses
:
An array that determines Headwind's default sort order.
tailwindCSS.headwind.removeDuplicates
:
Headwind will remove duplicate class names by default. This can be toggled on or off.
"tailwindCSS.headwind.removeDuplicates": false
tailwindCSS.headwind.runOnSave
:
Headwind will run on save by default (if a tailwind.config.js
file is present within your working directory). This can be toggled on or off.
"tailwindCSS.headwind.runOnSave": false
Coc-Tailwindcss works in 1 project but not the other
Hi,
I've been using Coc-vim along with coc-tailwindcss for a while now on a project. I just started a new project on the same computer and coc-tailwindcss does not seem to be working. I use a Rails template with TailwindCSS so I know that Tailwind is installed and working. Strange thing is, if I switch back to the other project, coc-tailwindcss works again. I have tailwind.config.js in both projects under app>javascript>stylesheets. plus I added tailwind classes to both and both render perfectly. So maybe the extension is not picking up Tailwind for some reason?? Any help is appreciated. Thanks!
:CocInfo gives me this:
auto-completion elsewhere than class
Related to #15
I'm working with d3.js, and using tailwindcss classes with the
.classed()
d3 methodI'd like to have coc-tailwindcss auto-completion when my cursor is within a
classed("")
, but so far coc-tailwindcss seems to only autocomplete html elements within aclass=""
. I couldn't understand where in your code you're setting this completion rule. Can we add custom locations to trigger coc-tailwindcss?Isnt working with coc
I'm unable to get this to work in my coc setup. Is there anything I need to know to get this to work? Are there anymore options I can set in CocConfig? I have a project with tailwindcss installed and I don't get any intellisense while editing.
Multiple filetypes (html.twig)
The classname suggestions only work if the filetype is
html
. Is it possible to make this work if the filetype ishtml.twig
(or anything else combined with html)?Works after running this in vim:
:set ft=html
. Doesn't work after running this::set ft=html.twig
.Anyway, great plugin!
warning from tailwindcss-language-server
Just installed coc and coc-tailwindcss, thanks for making it! While learning about coc, I found this warning:
Is that something to worry about, or I can ignore the warning?
my setup is very simple with the following code in my rollup.config.js:
Support for Elm language
Hi,
I am using tailwind with Elm for one of my projects. Currently coc-tailwindcss doesn't support Elm and I was wondering if it could be added. I am willing to do this myself but I can't really understand how to debug the extension. I would be glad for any help to add the support.
Thanks
It works under 1.0 ?
Hi, Now that tailwind reach an stable version I was wondering if it works. I was trying this repo https://github.com/tailwindcss/playground and under my (neo)vim doesn't works.
I try to put the config under the json file and also as a 'g:coc_user_config' property on my vimrc.
Thanks
Adding support for tailwind ppx
This is an exploratory pull request to add support for tailwind-ppx, a Reason/OCaml ppx that helps you validate your Tailwind classes at compile-time: https://github.com/dylanirlbeck/tailwind-ppx. The syntax is as follows:
I do need help understanding what to do with line
6908
, since the only way you get auto completion to show up is by forcing the function to returntrue
.Feel free to reject this pull request, though I thought that modifying the regexp adds little to no overhead to the language server. Cheers!
hbs does not support
In the same project, coc-tailwindcss for *.html works fine. When I switch into *.hbs file it doesn't work. In readme there is information that is supports handlebars. Should I configure something extra if want to use with .hbs files ?
chore(deps): bump follow-redirects from 1.9.0 to 1.14.7
Bumps follow-redirects from 1.9.0 to 1.14.7.
Commits
2ede36d
Release version 1.14.7 of the npm package.8b347cb
Drop Cookie header across domains.6f5029a
Release version 1.14.6 of the npm package.af706be
Ignore null headers.d01ab7a
Release version 1.14.5 of the npm package.40052ea
Make compatible with Node 17.86f7572
Fix: clear internal timer on request abort to avoid leakage2e1eaf0
Keep Authorization header on subdomain redirects.2ad9e82
Carry over Host header on relative redirects (#172)77e2a58
Release version 1.14.4 of the npm package.Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)@dependabot use these labels
will set the current labels as the default for future PRs for this repo and language@dependabot use these reviewers
will set the current reviewers as the default for future PRs for this repo and language@dependabot use these assignees
will set the current assignees as the default for future PRs for this repo and language@dependabot use this milestone
will set the current milestone as the default for future PRs for this repo and languageYou can disable automated security fix PRs for this repo from the Security Alerts page.
chore(deps): bump tar from 4.4.10 to 4.4.15
Bumps tar from 4.4.10 to 4.4.15.
Commits
843c897
4.4.1546fe350
Remove paths from dirCache when no longer dirsdf3aa4d
4.4.146d28013
add publishConfig tagefc6bb0
fix: strip absolute paths more comprehensively65edb39
4.4.13d04c3ff
Always provide a callback to fs.close()dbd6f52
4.4.120240086
update tap and minipass9232b3d
4.4.11Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)@dependabot use these labels
will set the current labels as the default for future PRs for this repo and language@dependabot use these reviewers
will set the current reviewers as the default for future PRs for this repo and language@dependabot use these assignees
will set the current assignees as the default for future PRs for this repo and language@dependabot use this milestone
will set the current milestone as the default for future PRs for this repo and languageYou can disable automated security fix PRs for this repo from the Security Alerts page.
Tailwind 3.0 Support?
The most recent update is one and half years ago, will coc-tailwindcss work with tailwind 3.x? if not is there other alternative for tailwindcss in vim? Thanks!
chore(deps): bump follow-redirects from 1.9.0 to 1.14.8
Bumps follow-redirects from 1.9.0 to 1.14.8.
Commits
3d81dc3
Release version 1.14.8 of the npm package.62e546a
Drop confidential headers across schemes.2ede36d
Release version 1.14.7 of the npm package.8b347cb
Drop Cookie header across domains.6f5029a
Release version 1.14.6 of the npm package.af706be
Ignore null headers.d01ab7a
Release version 1.14.5 of the npm package.40052ea
Make compatible with Node 17.86f7572
Fix: clear internal timer on request abort to avoid leakage2e1eaf0
Keep Authorization header on subdomain redirects.Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)@dependabot use these labels
will set the current labels as the default for future PRs for this repo and language@dependabot use these reviewers
will set the current reviewers as the default for future PRs for this repo and language@dependabot use these assignees
will set the current assignees as the default for future PRs for this repo and language@dependabot use this milestone
will set the current milestone as the default for future PRs for this repo and languageYou can disable automated security fix PRs for this repo from the Security Alerts page.
chore(deps): bump ajv from 6.10.2 to 6.12.6
Bumps ajv from 6.10.2 to 6.12.6.
Release notes
Sourced from ajv's releases.
Commits
fe59143
6.12.6d580d3e
Merge pull request #1298 from ajv-validator/fix-urlfd36389
fix: regular expression for "url" format490e34c
docs: link to v7-beta branch9cd93a1
docs: note about v7 in readme877d286
Merge pull request #1262 from b4h0-c4t/refactor-opt-object-typef1c8e45
6.12.5764035e
Merge branch 'ChALkeR-chalker/fix-comma'3798160
Merge branch 'chalker/fix-comma' of git://github.com/ChALkeR/ajv into ChALkeR...a3c7eba
Merge branch 'refactor-opt-object-type' of github.com:b4h0-c4t/ajv into refac...Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)@dependabot use these labels
will set the current labels as the default for future PRs for this repo and language@dependabot use these reviewers
will set the current reviewers as the default for future PRs for this repo and language@dependabot use these assignees
will set the current assignees as the default for future PRs for this repo and language@dependabot use this milestone
will set the current milestone as the default for future PRs for this repo and languageYou can disable automated security fix PRs for this repo from the Security Alerts page.
Not working with latest coc.nvim
Expected behavior Extension working
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Log:
Thanks for the hard work!
feat: support tailwindcss "v3" and use of server package
Description
The other day, version 3 of tailwindcss was officially released. https://github.com/tailwindlabs/tailwindcss/releases/tag/v3.0.0
The current coc-tailwindcss does not seem to be able to use v3 properly and comfortably. :(
I created a PR for v3 referenced on upstream code. 🙇 https://github.com/tailwindlabs/tailwindcss-intellisense/tree/master/packages/vscode-tailwindcss
As a side note, I have confirmed that tailwindcss v2 can also be used.
Summary
@tailwindcss/language-server
@tailwindcss/language-server
initializationOptions
are no longer required inv0.0.7
.tailwindCSS.showOutput
commandworkspace.showOutput
, but as with "upstream", we have added a dedicated command.tailwindCSS.cssLanguages
,tailwindCSS.jsLanguages
,tailwindCSS.htmlLanguages
settingstailwindCSS.includeLanguages
has been added.*
toworkspaceContains:**/tailwind.config.js
, etc...tailwindCSS.custom.serverPath
.DEMO (mp4)
Before
https://user-images.githubusercontent.com/188642/147442099-8a15b87e-cb00-4ce0-9f4c-d7ee5b37135b.mp4
After
https://user-images.githubusercontent.com/188642/147442111-db10823f-8fc8-40fc-88e3-54766201c625.mp4
[css unknownAtRules] [W] Unknown at rule @tailwind
Describe the bug
Here is what's in my style.css file:
I'm seeing the following error:
[css unknownAtRules] [W] Unknown at rule @tailwind
To Reproduce I simply followed your install instructions:
CocInstall coc-tailwindcss
Is there anything else I need to do?
Expected behavior I would expect not to see this error
Screenshots
Desktop (please complete the following information):