Use StandardRB to Format Ruby Code #6560
Replies: 4 comments 5 replies
-
Hey @willkoehler, thanks for this. Heads up I just released 1.25.1 which should fix the |
Beta Was this translation helpful? Give feedback.
-
By the way, since standard ruby ships with an LSP server, it'd be neat to see support for it in Zed. As an example, I recently published this VS Code extension that uses the LSP to avoid shelling out repeatedly for formatting and diagnostics |
Beta Was this translation helpful? Give feedback.
-
This doesn't work for me. I'm getting a "failed to format via external command" error from zed. I'm guessing because stderr is not empty? I put the following in a bash file and call that instead: #!/bin/bash
standardrb --fix --stdin ignored --stderr 2>/dev/null
exit 0 |
Beta Was this translation helpful? Give feedback.
-
I have tried this and also through Solargraph but no matter how I configure this, I get this in the logs:
I have tested calling this externally and it takes about 1.5s to spit out the formatted code. I know that isn't the fastest turn around but it doesn't seem entirely unreasonable. What is Zed's timeout for formatting? Is it configurable? |
Beta Was this translation helpful? Give feedback.
-
For people that use StandardRB (https://github.com/testdouble/standard), here's the configuration I'm using.
Make sure you have
format_on_save
turned on (see caveats below)A Few Caveats
parallel: false
). This is the default. Just make sure you didn't turn it on at some point. Otherwise StandardRB will run quitely but you won't see the fixes in Zedbundler
because I don't think you can control what path Zed runs commands from (to be fair I'm mostly guessing, based on comments here https://github.com/zed-industries/community/discussions/1017#discussioncomment-5292800)ignored
is required by Rubocop as a parameter for--stdin
. It's supposed to be "...a path, relative to the root of the project. RuboCop will use this path to determine which cops are enabled" But, from what I can tell, this is ignored by StandardRB./cc @searls Zed looks really promising. I'm excited to start using it and helping to improve the Ruby experience. Integration with StandardRB was one of the first things on my list.
Beta Was this translation helpful? Give feedback.
All reactions