Michael Hutchinson implemented code analyzation quite some time ago, now that we've branched 2.6 we can add new features to master. I've added quick fixes & joined the two systems.
Quick fixes are like refactorings - they change code. But unlike most common refactorings they're much more fine grained and may add code. For example adding a property setter.
When the caret is on a position where a quick fix is available a little icon is showed indicating the fix. In conjunction with the AnalysisCore source code can be highlighted indicating a more pressuring fix which - for example removing code smells.
Link to quick fix demo.
I can need more suggestions for quick fixes & indicators. I'll try to add as many as possible - unfortunately this feature doesn't make it into 2.6. But it's available in master as well as some other exciting features.
12 comments:
Our analysis has nothing to do with gendarme. We're analyzing expressions and help our users writing better code.
Yes we do the same things in some degree - like checking names for FDG conformance. Gendarme is on a more abstract level. In theory we could convert all gendarme rules to 'on the fly' rules. But currently there is no plan doing that.
I only lay the foundation and implement some >rules<. But getting all rules is something where we need help. I don't know how many quick fixes I'll implment, but I want to make control flow analysis next and adding a color sheme editor ... some people think that it's urgent.
In case of gendarme it's unfortunate that they didn't provide good monodevelop integration. The monodevelop team can't do all :(
Wow this is great! I always look forward to the MD releases.
implement property/function/field and with property (read only, r/w, auto)
would be high on my list.
I'd love to see the "add an import" thing from R#.
So if I do this:
NSDictionary d = new NSDictionary();
it offers me "add import of MonoTouch.Foundation?"
(hope that makes sense - looks VERY nice!!)
Something like ALT + Enter in Resharper. Based on the warning / suggestion it shows a short list of possible actions to take.
Remove unused using statements.
I guess the quick fix is what I meant by ALT + Enter. First time I read it, it didn't come across that way... Should have watched the demo first. :)
Move class to a separate file would also be nice to have.
The most important things IMO are :-
1. Remove unused code
2. Extract method
3. Move class into it's own file
4. Copy Type
5. Create field/property from parameter
6. Extract method into a new class (don't think R# does this)
7. Auto generate Equals, GetHashCode
8. When instantiating a class that doesn't exist, create it.
9. Fix namespace to match folder structure
Can't wait to see what you come up with!
This is pretty awesome! Especially the automatically generating labels for switches! I'd have killed for that a few months ago when i was implementing a lot of switch statements over an enum type :)
dru: That can easily be done with code snippets already.
Nic: Type "NSDictionary" and then right click on it. You'll see the option to add the necessary using statement then :)
Jason:
The most important things IMO are :-
1. Not supported as far as I know
2. Already supported
3. Already supported
4. No idea what this is
5. Maybe supported?
6. Not supported
7. Not supported i think
8. This does work for methods, never tried with classes. It might be supported
9. Would be nice if that was done automatically when a new class is created alright.
7. Is supported through the alt+ins feature - like in r#
How easy is it to setup and share keyboard bindings? My biggest issue is discoverability of a lot of these features - I'd love to have a key mapping that matched (as closely as possible on OS X) the Resharper IntelliJ shortcuts for each.
Post a Comment