-
I'm playing around with Phlex and I can really see some potential here. It's a very cool project. However the fact, that I cannot get the Tailwind CSS IntelliSense VSCode extension working, is holding me back from wanting to use it. This may very well be just me, who cannot figure out how to configure it correctly 🙂 |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 6 replies
-
I expect Tailwind auto-complete extensions use an HTML parser. They would need to understand Ruby to work with Phlex. I think it should be possible to develop better editor tooling for Phlex (including Tailwind support) as an extension for the Ruby LSP project in the future. I don't think the extension API is ready yet. |
Beta Was this translation helpful? Give feedback.
-
I think the Tailwind auto-complete extension actually uses regex. I haven't tested this with VSCode, but you should be able to use the Might need to mess around with |
Beta Was this translation helpful? Give feedback.
-
Made it work - using Lsp Config in Neovim and played around a little: https://gist.github.com/zealot128/cf8b0ad74df5a9ab3e734b9e6acc41e8 filetypes = { "aspnetcorerazor", "astro", "astro-markdown", "blade", "clojure", "django-html", "htmldjango", "edge", "eelixir", "elixir", "ejs", "erb", "eruby", "gohtml", "haml", "handlebars", "hbs", "html", "html-eex", "heex", "jade", "leaf", "liquid", "markdown", "mdx", "mustache", "njk", "nunjucks", "php", "razor", "slim", "twig", "css", "less", "postcss", "sass", "scss", "stylus", "sugarss", "javascript", "javascriptreact", "reason", "rescript", "typescript", "typescriptreact", "vue", "svelte", "ruby" },
init_options = {
userLanguages = {
ruby = "php",
},
},
settings = {
tailwindCSS = {
experimental = {
classRegex = {
-- add class: "..." and class: ''
[[class= "([^"]*)]],
[[class: "([^"]*)]],
[[class= '([^']*)]],
[[class: '([^']*)]],
--
-- '~H""".*class="([^"]*)".*"""',
-- '~F""".*class="([^"]*)".*"""',
},
}
}
}
KISS regexp parsing can do most of the job I guess.. :) |
Beta Was this translation helpful? Give feedback.
-
Here is the configuration for VSCode using the same tailwind-intellisense's You need to first turn it on for Ruby using {
"tailwindCSS.includeLanguages": {
"ruby": "html"
},
"tailwindCSS.experimental.classRegex": [
"\\bclass:\\s*[\"']([^\"']*)[\"']",
]
} If you want to only enable it only for the Ruby language for safety, you can specify it in the [ruby] settings block, (and [erb] if you want that too). {
"tailwindCSS.includeLanguages": {
"ruby": "html"
},
"[ruby]":{
"tailwindCSS.experimental.classRegex": [
"\\bclass:\\s*[\"']([^\"']*)[\"']",
]
},
"[erb]":{
"tailwindCSS.experimental.classRegex": [
"\\bclass:\\s*[\"']([^\"']*)[\"']",
]
}
} |
Beta Was this translation helpful? Give feedback.
Made it work - using Lsp Config in Neovim and played around a little:
https://gist.github.com/zealot128/cf8b0ad74df5a9ab3e734b9e6acc41e8