-
Notifications
You must be signed in to change notification settings - Fork 128
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
Add default ruby configuration for visual studio code #1958
base: main
Are you sure you want to change the base?
Add default ruby configuration for visual studio code #1958
Conversation
Hi @vinistock , I am trying to fix issue #1619, could you please help to guide how can I test ? I try to run Ruby-LSP: restart, but seems new configuration is not working. |
I have signed the CLA! |
}, | ||
"[ruby]": { | ||
"editor.defaultFormatter": "Shopify.ruby-lsp", | ||
"editor.formatOnSave": true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, but it doesn't seem to me that this should be the default value. When saving, I want to save what I am seeing now, unless I have explicitly defined it that way. This can be problematic especially when Rubocop is very aggressive in its corrections.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@brunoprietog Yep, I've updated the code, thx.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do want this to be formatOnSave
, as it is the current recommendation. We believe this is the best approach for the vast majority of developers. Saving only runs the autocorrects that RuboCop treats as safe, so it's very unlikely that this would result in incorrect code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So may I know do we have final decision for this ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, we do want this value to be true
. The idea of the recommended defaults is for a user of the Ruby LSP to get all features out of the box, even the ones that might be turned off by default by VS Code.
For example, formatOnSave
and formatOnType
are both turned off by default, which leads to many people not realizing that the Ruby LSP can auto-complete end
tokens for you as you type without the need to add any other extensions.
And remember, this is just a default recommendation. You can very easily turn this off.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
formatOnType I understand, but formatOnSave I still think is dangerous. When you do the save action you expect a result. If you have manually included that feature, you know that there is a chance that it will be formatted on save, which is understandable. But if you have never enabled this option, what is expected is simply to save, without doing anything. Entering this option by default means that. Most people will not know that it is enabled and could run into unpleasant surprises when saving without knowing that this option is enabled. It is very different when you activate the option manually, because you really know what is going to happen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally, I had this feature enabled at first, but I disabled it, as it happened to me several times that when applying a replace on several files at once, more than one file was left empty, and it took me quite some time to find out the reason. It has never happened again with formatOnSave disabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@brunoprietog if you can reproduce, then please create an issue for this so that we can address.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It wasn't a problem with Ruby LSP, it was a problem with VS Code in general that happened to me with several file types, not just Ruby.
@jenenliu yes, absolutely. Here are the steps to test this:
|
@vinistock I've tested, it works as expected, thanks a lot. Now if |
6c0d79e
to
557ead9
Compare
This pull request is being marked as stale because there was no activity in the last 2 months |
@aryan-soni could you please help to review ? thx |
Motivation
I am trying to fix this issue #1619. Add recommand default configurations for Visual Studio code.
Implementation
Add [ruby] configuration to
ConfigurationDefault
invscode/package.json
Automated Tests
Not yet
Manual Tests
Not yet