Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tailwind LSP takes precedence as a formatter in Ruby files #12973

Closed
1 task done
vitallium opened this issue Jun 13, 2024 · 4 comments
Closed
1 task done

Tailwind LSP takes precedence as a formatter in Ruby files #12973

vitallium opened this issue Jun 13, 2024 · 4 comments
Labels
defect [core label] language server An umbrella label for all language servers language An umbrella label for all programming languages syntax behaviors ruby Ruby programming language support tailwind css Tailwind CSS styling framework support

Comments

@vitallium
Copy link
Contributor

vitallium commented Jun 13, 2024

Check for existing issues

  • Completed

Describe the bug / provide steps to reproduce it

  1. Open a Ruby project with the solargraph LSP enabled.

  2. Enable tailwind-language-server for Ruby in Zed settings (order does not matter):

    "Ruby": {
       "language_servers": [
         "tailwindcss-language-server",
         "solargraph",
         "!ruby-lsp",
         "..."
       ]
     }
  3. Go to any Ruby file and attempt to format it.

  4. Nothing happens.

  5. Open settings again and disable tailwindcss-language-server LSP.

  6. Restart language servers.

  7. Try to format the file again. The file will be formatted.

Environment

Zed: v0.141.0 (Zed Dev cfbf5dc)
OS: macOS 14.5.0
Memory: 8 GiB
Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

No response

@vitallium vitallium added admin read Pending admin review defect [core label] triage Maintainer needs to classify the issue labels Jun 13, 2024
@vitallium
Copy link
Contributor Author

Not sure but I think when Zed registers LSP servers for languages it sets the tailwindcss-language-server as the primary LSP: https://github.com/vitallium/zed/blob/cfbf5dca7a8abe6286ca94a3a03a079f77e2869a/crates/languages/src/lib.rs#L191

languages.register_available_lsp_adapter calls the ctor of CachedLspAdapter and passes the is_primary param as true.

@notpeter notpeter added ruby Ruby programming language support language An umbrella label for all programming languages syntax behaviors language server An umbrella label for all language servers tailwind css Tailwind CSS styling framework support and removed triage Maintainer needs to classify the issue admin read Pending admin review labels Jun 13, 2024
@vitallium
Copy link
Contributor Author

I found this issue #11288 which seems pretty much about the same problem as I described here. I think we can close this one in favor of #11288.

@drale2k
Copy link
Contributor

drale2k commented Jul 12, 2024

Given this a little bump. Has been over a month now that we are not able to format on save using Ruby / Rails. Any update on this 🙏🏻

@vitallium
Copy link
Contributor Author

Closing this issue as I think my configuration is wrong for tailwind. The tailwind LSP should not be in the language_servers list. The correct configuration is the following:

"tailwindcss-language-server": {
  "includeLanguages": {
    "erb": "html",
    "ruby": "html"
  },
  "experimental": {
    "classRegex": ["\\bclass:\\s*'([^']*)'"]
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect [core label] language server An umbrella label for all language servers language An umbrella label for all programming languages syntax behaviors ruby Ruby programming language support tailwind css Tailwind CSS styling framework support
Projects
None yet
Development

No branches or pull requests

3 participants