Applying Suggested to the whole File

Hi,

I have a particular intention enabled (field could be made final). I have IntelliJ 12 now telling me when I visit a file that such and such a method/variable could be made final and gives me the opporunity to apply it (alt + enter). Is there a way for me to say to IntelliJ to apply this particular suggestion to the *whole* file, making all fields/methods final were appropriate? I'm refactoring a lot of legacy code with hundreds of lines + methods, and having to press alt+enter numerous numerous times in one file is very tiresome!

Thank you!

13 comments
Comment actions Permalink

After alt-enter, press "right", then select "Fix all xyz problems". That applies the quickfix to all warning in this file.

You can also run the inspection on a larger scope and fix the problems in multiple files at once.
To do that select "Run inspection on..." in the submenu that appears on "right" key after alt-enter.

1
Comment actions Permalink

Beautiful! Works fantastically!

:-)

-=david=-

0
Comment actions Permalink

Is it possible to do same, but with an _intention_ rather than _inspection_? For instance, there is this "Replace with property access" intention in WebStorm, and I have to _Alt+Enter_ each line separately just like the OP did. But it seems that simple intentions only have "Edit intention settings" and "Disable xyz", nothing like "Fix all xyz problems"...

1
Comment actions Permalink

No, Fix All is only supported for inspections

1
Comment actions Permalink

Please add "fix all" for intentions as well.

0
Comment actions Permalink

Hello,

Please clarify for what action do you expect the "fix all" intention to be available?

"Fix all" is not suggested for the intentions that are considered as "not safe".

Thank you 

0
Comment actions Permalink

For example : "JSHint : ['xxx'] is better written in dot notation (W069)"

0
Comment actions Permalink

JSHint errors can't be fixed, as the linter itself doesn't support quick fixes

0
Comment actions Permalink

I can auto-fix them one by one with "replace with property access". It would be nice to apply this to every w069 linter error in a file/folder

https://i.imgur.com/mwhPveT.png

0
Comment actions Permalink

This intention is not a quick fix for JSHint error; and, as the other intentions, it can't be applied to multiple elements at once

0
Comment actions Permalink

I know, that's why I said it would be nice if you added this feature :)

0
Comment actions Permalink

Would be really nice to have that for ShellCheck SC2086 ("Double quote to prevent globbing and word splitting.")

0

Please sign in to leave a comment.