Closed sergey-kintsel closed 8 years ago
Hi, thanks for your contribute. Let me ask a question.
Is there any problem if execute --auto-correct when saving file? (file reload problem etc..) I don't want to add shortcut keys. I worry about conflict with other extension and operation complexity.
I want to merge only a message for file not exist.
Hi, there should not be any issues with files. Because first, you save file, and only then RuboCop changes it to be correct.
removed hotkey
I want to add an option autoCorrect (bool). Then execute autocorrect when saving file if the option is true. (add no command)
Does this config helps your usage?
No. I think we can add this option, but my solution should be added as well. For example, rake db:migrate
in Rails creates db/schema.rb
with it's own formatting that is not allowed by RuboCop. But I don't want RuboCop change whole db/schema.rb
if I change something there. I mean sometimes I don't want RuboCop doing anything
I got it. I also checked Adding to exclude files on rubocop.yml was not solve this problem.
But I don't want to maintain two commands and two command-line option state for editing/saving on db/schema.rb that is often mistake. Saving without change don't execute rubocop(= vscode's onDidSave event).
Would you use this solution?
like :
{ "key": "shift+ctrl+r", "command": "ruby.rubocop", "when": "editorFocus" }
I thought that I've turned off onSave option here, haven't I? Also, I am not sure if I get you right. Why do we need this keybinding for ruby.rubocop
? I would agree if it would be { "key": "shift+ctrl+r", "command": "ruby.rubocopAutocorrect"}
because I think that RuboCop check should be invoked each time when we save file, no? We can take a look at Sublime's RuboCop plugin. It runs rubocop check each time when we save a file, also, it provides separate command for autocorrect. WDYT?
Also, it looks like we have a bug here, because rubocop.isOnSave
is a function and it always be truthy...
I understood surely different invoke frequency of lint and auto correct. If auto correct is heavy process we should not execute every saving. And nobody may use shortcut for ruby.rubocop.
I will test branch on local repository and merge this pull request. Could you add default shortcut key for rubocopAutocorrect?
isOnSave is an Accessor. not a function. https://www.typescriptlang.org/docs/handbook/classes.html
done
on
Ctrl+R
it will autocorrect whatever it can. Also, you'll see a message that file doesn't exist when specified config file is absent.