Question

In ReSharper 5.1 running on VS 2008, I am trying to complete a method name using CamelHumps with the following code:

public bool debugMode { get; private set; }
public DebugWindow()
{
    InitializeComponent();
}

public void logOutput(List<String> logLines)
{
    foreach(string line in logLines)
    {
        <- cursor is here
    }
}

public void logOutput(String logLine)
{
    debugTextBox.Text += "\n" + logLine;
}

At the above-noted cursor point I type lO and hit Ctrl+Space. I want it to present me with a prompt for the logOutput(String) method, but instead it presents me with a prompt for logLines with the one I want displayed underneath in the dropdown box. If I instead type lOu it gives me the correct prompt highlighted (same with lou), but I think I should be able to just type lO and it should work. I have CamelHumps checked under Resharper->Options->Editor. I also have hotkeys set to the Resharper defaults, rather than the VS ones.

I know this behavior existed in IntelliJ in the past, but this issue has irritated me ever since starting with ReSharper.

Is there something else I need to have selected/set in the options? Is this even possible in ReSharper?

I tried searching for other similar questions, but I've only seen comments/questions on the all lower case completion or camel case selection.

Edit: Note that both logOutput methods are present in the list of options for completion, but it's not selecting them as the completion to be inserted when I hit Enter. I would have to type additional characters to force it to choose one of them. So the issue is, previously in IntelliJ lO was sufficient to make it select logOutput as the one to be inserted because of the capital O; is that possible in ReSharper, and if so how?

Was it helpful?

Solution

I think the reason you are not getting the expected result is because of the name of the logLines variable. Because the first 2 letters of that variable are lo, it takes precedence over any CamelCase match. So i guess there must be some logic in Resharpers matching system that favours sequential characters over CamelCase matches.

For example, if you change the name of logOutput to something like storeOutput and then you type sO it will show you the prompt you expect (proving that CamelCase matching is working).

I've never used IntelliJ, but i expect it was probably the same logic in that, you just didn't notice because you didn't have clashing variable names.

You could always just hit the down arrow after Alt+Space to bring up the prompts for logOutput(...). That would get you the results you want and is only a single extra keypress.

OTHER TIPS

After waiting a few days for additional responses here, I went ahead and posted the question on the ReSharper forums over at JetBrains along with a link back here. The short answer is that it's not possible in ReSharper 5.1 and up.

For the full answer text, see: http://devnet.jetbrains.net/message/5455545

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top