zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
42.09k stars 2.2k forks source link

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

Open vitallium opened 1 month ago

vitallium commented 1 month ago

Check for existing issues

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 cfbf5dca7a8abe6286ca94a3a03a079f77e2869a) 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 commented 1 month ago

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.

vitallium commented 1 month ago

I found this issue https://github.com/zed-industries/zed/issues/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 commented 1 week ago

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 🙏🏻