-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
VSCode formatOnSave #113
Comments
I use the vs-code prettier plugin and it works for me with plugin-ruby. However, you have to install the plugin in the vscode plugin directory as it appears it doesn't look inside your project or even globally for plugins.
|
I've got this line in my settings.json:
After your recommended step, I still get no action after "running save participants". |
If I were to guess, I'd make sure that you have the most recent vscode-prettier plugin installed because I believe you will need prettier > 1.14. Also be sure to restart vscode after you added plugin-ruby to the vscode-prettier dir. I don't have a specific ruby section in my config, but I do have editor.formatOnSave to true. I also don't have any other ruby plugins in vscode. Not sure if something else is taking over? I found the tip from this thread |
I've narrowed it down a bit--looks like the
|
I have no idea what's going on with this and I don't use vscode, so any help on this would be appreciated! |
I'm also probably 0 help on the vs-code front. I suspect it's more an issue with the prettier plugin & rubocop. |
@chevinbrown there is a setting in vscode called |
@somebody32 💕 that's about it...For some reason, rubocop is still is the "preferred" formatter (it seems to just ignore prettier)? In any case, with an opinionated linter I can accept not having rubocop lint... We'll probably lean towards throwing rubocop in CI instead of the editor. |
For yall that are using vscode, do I understand it correctly that you have https://github.com/rubyide/vscode-ruby installed and that its automatically running rubocop and that's timing out? |
Not for me--I use solargraph...but I've just toggled between solargraph and vscode-ruby. Both run well alongside prettier plugin-ruby. 👍 |
I'm going to close this one in favor of tracking it over at prettier/prettier-vscode#731 |
Thanks for your work on this, @kddeisz! |
I found this workaround in prettier/plugin-ruby#113 and confirmed that it works. "Run on save" stopped working for me a while ago, so I'd recommend using prettier-vscode with the workaround instead.
I found this workaround in prettier/plugin-ruby#113 and confirmed that it works. "Run on save" stopped working for me a while ago, so I'd recommend using prettier-vscode with the workaround instead.
Just in case anyone else ends up here, I had to rebuild the |
@james-prado you're a lifesaver! Been banging my head trying to get this to work cause my team kept having whitespace changes. Much appreciated! |
Thanks @james-prado you are a life saver |
Manually installing the plugin in the extension itself is indeed what had made the trick for me initially, as for dozens of devs at the company I work at. However I do not think it is a desirable solution as it introduces a discrepancy between the version installed in the extension and that of your main project(s).
Some steps might be superfluous but this is the sequence that fixed several people's setup. |
I opened a PR to update the README: #867 |
Thanks. This comment is great for Mac and Linux. And I would like to add the equivalent location for Windows and WSL. I tried and both are OK.
Hope this helps for Windows and WSL users. |
Does this plugin work for Thank! |
When using nvm it seems that `spawnSync` can't find the node binary and the commands just fail awkwardly (spawnSync doesn't let us know it couldn't find the command). Related to prettier#113
When using nvm it seems that `spawnSync` can't find the node binary and the commands just fail awkwardly (spawnSync doesn't let us know it couldn't find the command). Related to prettier#113
Just integrated this with IntelliJ IDEA Ultimate and works great. Here are a few things I had to do before getting it working. Integrating this with VSCode worked pretty much OTB.
|
Hi! Just adding a piece of intel, may save someone an hour or two :) Spent quite some time trying to make Prettier format my Ruby files in VS Code. But VS Code was not offering "Format Document" context menu item for Ruby, and complained that no formatter for 'ruby' was installed.
Turns out, I had to explicitly specify |
Thanks for this, that's all mine was missing. Added this to my settings.json and I was set: replace ".path/to" with your actual path, which can be easily pulled from vs-code terminal with the command |
Metadata
Errything looks good from cmd/cli! 👏
The vs-code prettier plugin seems to reach for another tool? I've fooled around with a
.prettierrc
also, but I'm assuming this is still too new for the vscode plugin to have this parser integrated?The text was updated successfully, but these errors were encountered: