Intention to run intention

An idea for Dave:

I was working with a class that had lots of redundant casts all over the
place. The casts were not my focus but the 'Remove redundant cast(s)'
intention showed up so I used it to fix the problem, once. But I didn't want
to stop what I was doing to go run the 'inspect code' action and fix all of
the redundant casts at once.

So how about having an intention to run the proposed intention (or
quick-fix) on the entire file?

Like:
Remove redundant cast(s)
...
Run Remove redundant casts on entire file
(or)
Remove all redundant casts in file

Just a thought. Not a big deal, but I would more easily fix problems as I
see them without getting away from what I'm doing rather than explicitely
sitting down and using the code inspector.

Thanks,

Vince.


3 comments
Comment actions Permalink


IDEA will actually do that now, as of the last couple EAPs. Steps:

1)Have the "Redundant type cast" inspection enabled in the online error checking (which you already do, or you wouldn't have seen the errors).
2)Hit "Analyze\Run Inspection with Editor Settings" from the right-click menu in the editor. This is also helpfully mapped to Alt-Shift-I, a keystroke you will grow to love.
3)Watch the progress bar whir for a bit.
4)See the familiar inspection results panel come up. Only errors in the current editor window are shown.
5)Go to the line for "Redundant type casts", right-click, and select "Remove redundant casts", or whatever the quickfix is called.
6)Look over the other errors found, and do any batch cleanups desired.
7)Bask in the glow of IDEA's awesome power.

It's not better than sex, but sliced bread is getting a run for it's money.

--Dave Griffith

0
Comment actions Permalink

I misread. What IDEA does now isn't an intention, but is probably about just about as easy and powerful. Given the need to keep the number of lines in the intention list reasonably small and each error already adding two or three intentions (quickfix, suppress, and edit), I think that's likely to be more than adequate.

--Dave Griffith

0
Comment actions Permalink

Alt-Shift-I is definitely cool and I agree that the intention popup is
already getting crowded.

I was looking for a way to make the running of the quickfix as undisruptive
as possible and Alt-Enter/down/down/enter seemed easy enough. As I'm typing
this I've been playing with Alt-Shift-I and Alt-Shift-I/Down/Alt-Enter does
exactly what I needed. (I guess that could make it as a Tip of the Day).

IDEA is awesome.

Vince.




0

Please sign in to leave a comment.