Archive for the ‘Links and Opinions’ Category

Extend/Shrink Selection

Friday, January 25th, 2008

Note: This is the first post from a series that we’re hoping to maintain on a regular basis. It will cover specific features provided by ReSharper with reasonable (or even redundant, for true ReSharper Jedis) details, links to other valuable web resources and probably some additional insight. You can think of it as extended online help for those users who feel not very comfortable learning or navigating through ReSharper functionality, as well as for those eager to gain additional expertise.

The Extend Selection feature allows you to successively select expanding blocks of code. You can easily select any expression in the code by clicking somewhere inside it and pressing Ctrl + W (or Ctrl+Alt+Right Arrow in the Visual Studio keyboard layout) a few times, or, alternatively, by choosing ReSharper | Code | Extend Selection.
 
To be specific, Extend Selection works the following way:
 

  1. You place the caret at an arbitrary position - in this example, at a field name in a method call.
  2. You press Ctrl + W for the first time.
     

    • If you selected Use CamelHumps in ReSharper | Options | Editor, the initial selection is made covering the current part of field name that begins with an uppercase character:

      It’s only after you’ve pressed Ctrl + W once more, the whole current word is selected.
    •  

    • If CamelHumps is disabled, ReSharper selects the complete field name straight away:
  3. Press Ctrl + W again. ReSharper extends the selection to cover the field property:
  4. The next time you hit the shortcut, the method name is added to the selection – without parentheses though:
  5. Next expansion – parentheses are added:
  6. We’re done with the method call expression. The next time you press Ctrl + W, the whole line is selected:
  7. How the feature acts further depends on the structure of your code. In our example, the method call belongs to the body of a conditional statement. That’s why the next time you hit the shortcut, the whole body is selected, excluding braces:
     

 
In this example, consequent keystrokes extend the selection to cover the following:
 

  • Body of the conditional statement including braces;
  • The conditional statement including condition;
  • Body of the method containing the conditional statement;
  • The entire containing method;
  • The class that this method belongs to;
  • The entire file.

 
Obviously enough, Shrink Selection does exactly the opposite. Press Ctrl + Shift + W (or Ctrl+Alt+Left Arrow in the Visual Studio keyboard layout) or choose ReSharper | Code | Shrink Selection a number of times, and you can eventually find your selection cut down to the initial position of the caret in strictly reverse order.
 
This feature is very intuitive but please be aware that there are several scenarios where it should work on a limited basis or not work at all.
 

  • ReSharper doesn’t process HTML and JavaScript. Because of that, Extend/Shrink Selection interprets any block of JavaScript or HTML code as an integral entity within a pair of tags and only discerns specific words within this block. In other words, when you’re working on an aspx file and you place the caret at a certain position within a JS or HTML block of code and you hit Ctrl + W, ReSharper selects the current word, and upon the next keystroke it selects the entire block of code within a pair of containing tags (for example, in case of JavaScript).
  •  

  • You should start with extending a selection using Ctrl + W in order to be able to shrink it back later. In other words, if you made a random selection with your mouse or by clicking Ctrl + A, you can’t shrink it using Ctrl + Shift + W because in this case ReSharper doesn’t know exactly what file member you want to cut the selection to.
  •  

  • Extend/Shrink Selection supports CamelHumps-based selections within both C# comments (//, ///, /**/) or VB.NET comments. However, commented code is not parsed and therefore interpreted as an integral entity (see note on JavaScript and HTML above).
Technorati tags: , , , , , , ,

Solution-Wide Analysis Explained

Tuesday, December 25th, 2007

As announced before, ReSharper 3.1 provides a new full-fledged feature called Solution-Wide Analysis, which looks for erroneous C# code in your solution on-the-fly, without compiling it first.
 
So how does it work?
 
Suppose that you changed the visibility of a member from public to internal, assuming that it was only used inside the current assembly. At this stage, ReSharper finds no errors in the current file. Then, you switch on Solution-Wide Analysis and the circle indicator in the status bar turns red. You jump to the next error in solution and you find out that someone used this member from outside of the current assembly. You make necessary amendments, and that’s all! No need to compile, then look for errors, then fix them, and finally repeat the whole process over and over again.
 
Initial analysis may take some time to complete while you continue your work, but after it is done, only files that can potentially be affected by recent changes are reanalyzed.
 
Note that this feature is disabled by default and should be explicitly configured for every new solution you use.
 
To switch Solution-Wide Analysis on, just double-click the gray circle in the right corner of the status bar. After that, when the Solution-Wide Analysis tab displays in the Options dialog box, select Analyze errors in whole solution.

 
ReSharper Options dialog box: Code Inspection: Solution-Wide Analysis
 
Switching on Solution-Wide Analysis is signified by several changes in UI:

  • The circle indicator in the right corner of the status bar displays the progress of Solution-Wide Analysis. Initially, it is gray, but after analysis is complete, the indicator turns either green (if no solution-wide errors were found) or red (if errors were detected).
  • A small area to the left of the circle indicator is allocated to show the number of solution files that contain errors, if any.
  • Names of several Go to commands are extended. Specifically, Go to Next Error changes to Go to Next Error in Solution and Go to Previous Error becomes Go to Previous Error in Solution.

To view the list of errors found in solution, double-click the circle indicator. The Errors in Solution window opens where you can view the list of detected errors and navigate to them in code by double-clicking their respective descriptions.
 
ReSharper windows: Errors in Solution
 
Even without opening that window, you can still easily navigate through errors in your solution with Go to Next Error in Solution (Alt+Shift+Page Down or Alt+F12) and Go to Previous Error in Solution (Alt+Shift+Page Up or Shift+Alt+F12) commands.
 
You might also like to know what others have to say about this wonderful new feature:
Brian Di Croce reviews ReSharper 3.1
Ilya Ryzhenkov, .NET Tools Product Manager at JetBrains, reviews an earlier version of Solution-Wide Analysis and answers your questions
Jonas Bandi emphasizes the role of Solution-Wide Analysis as a means to differentiate between developing and building solutions. So do Jean-Paul S. Boodhoo and Joey Beninghove.

Technorati tags: , , , , , ,

Søren Lund Reviews ReSharper 3.0

Monday, July 2nd, 2007

Søren Spelling Lund, a lead developer at Vertica A/S of Denmark, has posted a ReSharper 3.0 review at his blog.

Søren first points out the usability improvements such as our new keyboard scheme choices and a versatile set of options. He then goes on to mention the latest productivity tools added in ReSharper 3.0, including VB.NET support, To-do lists and Unit testing. He also praises a number of other features which we’ve had for a while but managed to improve in 3.0: background code analysis, code refactorings, code completion and others.

To sum it up, Søren declares: “Visual Studio brings a lot of productivity to the table… ReSharper takes many of these familiar tools to new levels and adds new functionality to the best development environment out there… ReSharper truly delivers on JetBrains’ promise of “develop with pleasure.”

We’re flattered :)

The ReSharper Jedi

Thursday, May 31st, 2007

There is a growing talk in the blogosphere of what it means to be a’Resharper Jedi’. Beside the obvious fact that to be a ReSharper Jedi one must be a ReSharper user, the community consensus of the word is beginning to mean: One who can code hella fast with ReSharper and blow productivity levels off the chart. By this definition alone, the community has already recognized super coding mavens Jean-Paul Boodhoo and Oren Eini (code named: Ayende) as members of the ad hoc created ReSharper Jedi Coucil. I am sure there are many more ReSharper Jedis lurking in the shadows who generally go unnoticed because they’re not as openly active in the community. In fact, one such ReSharper Jedi, who is in fact a ReSharper Master Jedi (Oohhhhhhhhhhh) is the Product Manager and Lead Developer for ReSharper … none other than JetBrains’ own Ilya Ryzhenkov.

Now, I’m sure from a speed perspective, there may not big a big difference among Jedis, but we all know that each Jedi are unique and have certain powers that other Jedis may not have. Ilya’s Jedi power is that he likes to use ReSharper to code in reverse. If you want to witness this insanity for yourself, check out his Coding Session with ReSharper found at his blog. (don’t be shy to crank up the jams … )

Other Jedis may wish to subscribe to his blog, because he will be increasing the frequency of his ReSharper for Experts posts after the latest release of ReSharper hits internet store shelves mid-June 2007. So, stay tuned!

Oh, and if you’re going to be a ReSharper Jedi, there are a few codes by which you should live by:

ReSharper Jedi are the guardians of quality and productivity in the .NET world.
ReSharper Jedi use their powers to improve and advance source code, never to degrade.
ReSharper Jedi respect all developers, in any language, with any tools.
ReSharper Jedi serve others rather than ruling over them, for the good of the .NET world.
ReSharper Jedi seek to improve themselves through knowledge and training.


Don’t forget them. :-)

Technorati tags: , , ,

ReSharper: Don’t Develop Without It

Tuesday, April 17th, 2007

We’ve blogged about this feature before (searching for things by name, including types, files, methods within a file and more). Scott Cate has listed it as his favorite feature of the day in his blog post ReSharper: Don’t develop without it.

Hope you’re enjoying Ctrl+Shift+N, Scott (and all other users, too) :)

P.S. On the topic of ReSharper’s price tag, please be aware that we offer Personal Licences to individual ReSharper users. You can save $100!

,

Swiss Army Knife, Mind-Reading and More ReSharper Goodness

Thursday, February 22nd, 2007

If you happened to miss the latest installments in Joe White’s 31 Days of ReSharper series, here’s a recap of the last week’s posts.

Joe mostly blogged about two things: first, completing code with the Ctrl+Space family of shortcuts, and second, doing a whole bunch of useful things with Alt+Enter. Here are a couple of things I enjoyed reading (besides the lucid explanation of technical details behind ReSharper’s features):

“I’ll talk about one of the keystrokes you’ll use most often with ReSharper: Alt+Enter. I referred to it earlier as ReSharper’s “Swiss Army knife”, because it’s so versatile: it can fix certain compiler errors, complete code, remove code that’s never used, and just in general automate some of the repetitive tasks that come with writing code.” (read more…)

and

“When you select Change All, you’ll get a suggestion list. Often there’s only one suggestion, and it’s exactly the one I want. It’s so good it’s spooky…In a lot of cases, you’ll end up with just one parameter, or just one property, that satisfies the way you’re using that symbol. Which makes it look like ReSharper is reading your mind. (It pretty much is!)”(read more…)

The individual blogposts included:

Day 14: Suggested variable names
Day 15: The Ctrl+Space family
Day 16: Importing namespaces with Alt+Enter
Day 17: Change All with Alt+Enter (and, Introducing the red light bulb)
Day 18: Adding things with Alt+Enter
Day 19: Implement Members with Alt+Enter
Day 20: Fix errors and warnings with Alt+Enter


Technorati tags: .NET, ReSharper, Visual Studio, C#

Days of ReSharper: 14/31

Tuesday, February 13th, 2007

Joe White provides free ReSharper training to all those interested (and keeps us, the ReSharper team, on our toes) with his 31 Days of ReSharper.

Each post is a How-To of a particular segment of features, full of tips and tricks and other useful info. Posts occasionaly include comparison analysis and mini-case-studies from Joe’s personal and corporate development experience.

It is now Day 13, with 14 total posts, since a programmer’s counter starts from 0 ;)

The following 7 posts have been added:

Day 7: Code formatting - how to format as you type, formatting entire file, and so on;
Day 8: Find Usages - finding usages, filtering for “get” and “set” usages… interesting discussion about the Find Results tree;
Day 9: Parameter Info - the ins and outs of using ReSharper’s parameter info;
Day 10: Go To Type - one of the most time-saving features (also see our own Go To Type how-to);
Day 11: Code navigation - Navigate From Here context menu, Go to Declaration, and gutter icons. Some useful info there; for the rest of navigation features, see these Navigation & Search feature descriptions (although Joe probably has more coming in this section);
Day 12: Type Hierarchy view - the dirty lowdown on using the nifty Type Hierarchy view.
Day 13: File Structure view - useful for sorting methods, handling regions, and more.

We don’t know if you are on schedule so far, Joe, but each post is a great read, so keep it up :)

Technorati tags: .NET, ReSharper, Visual Studio, C#

31 Days of ReSharper: the Blog

Tuesday, February 6th, 2007

Blogger Joe White is attempting what no other human has attempted before — to blog 31 days straight about ReSharper in the month of February (by Joe’s own admission he states, “Yes, I know there are only 28 days in February. But ReSharper is just that cool.”). Joe’s first blog post covers the basics, including installation, version information (VS 2003 & VS 2005), and a few other helpful things a newb might need to know. Second day includes tid-bits about what you’ll see out of the box, etc. The 3rd and 4th days start to pick things up. Therefore, I encourage you to check out his full-entries on his 31 days of ReSharper blog post:

http://excastle.com/blog/archive/2007/01/31/13141.aspx

Joe, if you read this, please be gentle :-) On second thought … no mercy Joe, no mercy. If something bothers you, if you’d like to see something that isn’t there, or if something isn’t intuitive enough, say it — we’re paying attention. After all, to use one of the most mis-used and ill-quoted pieces of all time (vide Nietzsche):

“That which does not kill us makes us stronger. “
(original: Mich nicht umbringt, macht mich starker)

That is, of course, what everybody says.

David Stennett
Team JetBrains

Technorati tags: .NET, ReSharper, Visual Studio, C#

ReSharper: Power Tool You Cannot Do Without

Wednesday, January 24th, 2007

We’ve said time and again that ReSharper is the most intelligent add-in to Visual Studio. Patrick Riva concurs. By his own admission, of all power tools, ReSharper is the “one you couldn’t do without.”

Read the full post http://justadev.blogspot.com/2007/01/power-tools-resharper-definitely-most.html.

“Just try it and you’ll love it,” says Patrick. We hope more and more developers will take his sincere advice ;)

What’s Your Best Pick for a Web Application Development Tool for ASP.NET 2.0?

Monday, January 15th, 2007

Ray Linder reviewed the most popular products for easier web application development for ASP.NET 2.0 in Visual Studio 2005. The showdown included: ReSharper vs. CodeRush vs. CodeSmith vs. Visual Assist X.

Ray was of the opinion that, while other products provide nice gadgets and visual effects, ReSharper is the tool that actually speeds up your work!

Read the full blogpost at http://blogs.clearscreen.com/raylinder/archive/2007/01/14/5963.aspx

And what are your thoughts on this?