zed
zed copied to clipboard
Tailwind LSP support in Ruby files for Phlex Components
Check for existing issues
- [X] Completed
Describe the feature
Similar to https://github.com/zed-industries/zed/issues/6340 and https://github.com/zed-industries/zed/issues/6306, Tailwind LSP auto-complete would be useful in Ruby (.rb) code for authoring Phlex components.
If applicable, add mockups / screenshots to help present your vision of the feature
I have this working in Sublime Text at https://gist.github.com/bradgessler/1907d07593918fb5d2f27911bccc75f4
Here's what it looks like in .rb files when decorating the class: attribute with a Tailwind class:
I agree this would be a kiler feature. One way to get there might be to support language server configuration so the community can build support for things like this. See https://github.com/zed-industries/zed/issues/4511
I would be a lot more motivated to build a Phlex extension for ruby-lsp if I could configure Zed to use it.
People have been able to get this working in Neovim and VS Code. https://github.com/orgs/phlex-ruby/discussions/536#discussioncomment-5543709
In VSCode, Tailwind can be configured to work in Ruby files like this. Is there any way to access the same configuration in Zed?
{
"tailwindCSS.includeLanguages": {
"ruby": "html"
},
"tailwindCSS.experimental.classRegex": [
"\\bclass:\\s*[\"']([^\"']*)[\"']",
]
}
This would be great. I am not using phlex but this addition would also make it work for standard ERB rails helper tags, like
<%= f.label :keywords, class: "block text-sm ... i assume? Currently it only works with plain HTML in ERB files
I think we will be able to have it working soon after https://github.com/zed-industries/zed/issues/5830 and https://github.com/zed-industries/zed/pull/11360 🚀
That’s awesome!
I'm pretty sure with these settings and the latest version of the Ruby extension (which includes this: https://github.com/zed-industries/zed/pull/12742) this is fixed:
{
"languages": {
"Ruby": {
"language_servers": ["tailwindcss-language-server", "..."]
}
},
"lsp": {
"tailwindcss-language-server": {
"settings": {
"includeLanguages": {
"erb": "html",
"ruby": "html"
},
"experimental": {
"classRegex": ["\\bclass:\\s*['\"]([^'\"]*)['\"]"]
}
}
}
}
}
And @joeldrapper tweeted that it works: https://twitter.com/joeldrapper/status/1798812799898136856
Happy to reopen if it doesn't work though.