[MonoDevelop] what's your top ten resharper features.

Oliver Stieber oliver.stieber at ukplc.net
Thu Mar 19 05:18:08 EDT 2009



-----Original Message-----
From: Michael Hutchinson [mailto:m.j.hutchinson at gmail.com] 
Sent: 18 March 2009 23:46
To: Oliver Stieber
Cc: monodevelop-list at lists.ximian.com
Subject: Re: [MonoDevelop] what's your top ten resharper features.

On Wed, Mar 18, 2009 at 11:46 AM, Oliver Stieber
<oliver.stieber at ukplc.net> wrote:
> I'm still working on a resharper like addin and I would like to know what are your top ten resharper features that you like. Well, maybe not all ten but the things you like the most and the things it doesn't do that maybe it should.
>
snip
> And maybe a few others I forgotten.
>
> (things I hate are invert if statement, tried it once, was a bit of a fiddle to undo and made my code really unflexable when it came to wanting to do things in the future)
>
>
> *****************************
> Some things I would like to add that it doesn't do:
> *****************************
>
> Suggest using an interface or base class when possible to use it instead of the declared class (I think later version of resharper than I'm using do this but I haven't come across it doing it yet).
>
> Show scope of a variable, and in the case of a variable being used before it's assigned show the scopes that it wasn't assigned in.

How would this be shown?

Say by changing the background colour of the editor in the scope to light blue, etc....

So it look like this (where * is a line that has a background blue), this is an example of a being used before it's assigned.

int a;

if (foobar)
{
	a = 1;
}
Else
{
*	dosomething();
}
Barrab = a;





> Move the variable to the inner scope it could have been declared in.
>
> Wrap a class, i.e. have a class as a private member and wrap all it's methods for when you don't want to inherit it. (this may also be nice to do with with event's when a method is hit too)
>
> *****************************
> Some sudo-python features.
> *****************************
>
> Based on the usage of a variable:
>
> declare it in the class, as a function parameter or as a variable in the function. And suggest it as a variable name in code completion if the type is correct.

Sounds useful, though I've seen some screenshots of pretty horrible
name suggestions in resharper ;-)

For this I would do something like


Class A
{

	void function1(int b)
	{
		_C = b*5;	
	}
}

Could suggest, declare _C as an int, could suggest the name of a int member of A as being name _C could suggest to make _C a public / private/ internal etc... int member of class C, could suggest to add an extra out int to function1 called _C. 

So I'm not intending to make up names I'm intending to declare things you've used but haven't declared so you can write code without bothering to declare your variables.





> Create a new Class / Interface / Struct for the variable with members based on the functions and fields / properties used on that variable.
>
> Create a new function based on how it's called.

That's probably my favourite. I think VS does this :)

> *****************************
>        Coding standards checks probably as an additional addin.
> *****************************
> Some basic, but hopefully extensible coding standards.
>
> Like using GetString, String.Format for strings and other (as defined by the user) best practices, don't declare members public use properties. I'll probably start with some of the IDesign list and see what can be automated.
> Enforcing naming conventions as much as possible
> Spell checking comments
> Spell checking variables, function, class etc.. names (so long as Pascal, Camel or C&R type naming conventions have been used)

My biggest question for all of this is how you plan to implement this.
Would it be something very C#-specific, based on NRefactory? Some of
it could be based on general postprocessing of the parsed DOM. I've
actually been considering something a bit like this already, for ASPX
and HTML files.

My rough plan goes as follows:
* any file could have multiple parsed outputs, e.g. an HTML DOM, a
MonoDevelop.Project.Dom/.NET compilation unit, a list of strings, a
list of errors, a list of folds, etc
* parsers would either operate on raw files, or other parsers'
outputs. For example, the spell checker could operate on string lists,
producing error lists. The ASPX parser could produce a C# text output.
* some output would be persisted to databases. Others would be created
on demand. So there would have to be a way to register active "sinks"
for parsed information.
* the text editor would register a sink for folds and error lists on
the files it had open

The parser service would have a trickier time scheduling all of this,
but it could do interesting things like scheduling different parsers
with different priorities, using multiple cores, etc.

------------------

Sounds good, as with everything I plan to implement in as generic way as possible so that it should be applicable to other things. The core would just be a string splitter recognises a few coding standards so as to make it work out of the box. and run a spell check on those strings with fairly standard spellchecking rules. E.g. ignore single letters, ignore numbers, add to dictionary etc... it shouldn't be too hard to warp that around any language. I wouldn't obviously have to build a project / assembly specific dictionary with existing names and keywords in it so as not to overwhelm people with spelling mistakes that aren't.




-- 
Michael Hutchinson
http://mjhutchinson.com


More information about the Monodevelop-list mailing list