Can't extract method when I think I should.

I downloaded Uncle Bob's bowling kata slides yesterday and started to practice. (http://butunclebob.com/ArticleS.UncleBob.TheBowlingGameKata)

During the kata - when you get to a point where you are calculating the score I ended up with some code that looked like

               for (int frame = 0; frame < 10; frame++)                {                     if(IsStrike(frame))                     {                          score += 10 + _rolls[frame + 1] + _rolls[frame + 2];                          frameIndex++;                     }



I expected to be able to highlight the part that says "_rolls[frame + 1] + _rolls[frame + 2]" and extract method. However this feature is disabled when this block of code is selected.

I'm using Visual Studio 2010 Ultimate and writing the kata in C#. I also have the first EAP build of 5.1
JetBrains ReSharper 5.1   Full Edition build 5.1.1700.249 on 2010-05-20T16:48:06

JetBrains ReSharper 5.1 package for Microsoft Visual Studio. For more information about ReSharper, visit http://www.jetbrains.com/resharper/. Copyright © 2003–2010 JetBrains, Inc.




Any thoughts?
1 comment
Comment actions Permalink

Hello Jason,

The problem is that expression  a + b + c  is actually (a + b) + c (in terms
of syntax trees). R# works with the syntax tree of the expression and in
your case there is no valid subtree selected.

This is a known issue. Unfortunately we have no plans to fix it.


0

Please sign in to leave a comment.