skip to Main Content

I’m encountering an issue when using both ReSharper and GitHub Copilot in Visual Studio 2022. Both of these tools offer code suggestions, which is incredibly helpful, but they sometimes clash, leading to code that is unusable.

  • When I start typing code, for instance, if I input the letter "i," ReSharper immediately suggests an "if" statement. On the other hand, GitHub Copilot, provides a complete statement that fits the context of what i am trying to do, and both are shown at the same time; ReSharper with its context menu, and Copilot with its in-line suggestion.

ReSharper suggestion:

if (expr)
{
    
}

Where it moves the caret into the expr, in order to let me fill in the expression.

Copilot suggestion:

if (Logger.IsDebugEnabled)
    Logger.Info($"GetNearestClimate returned: {climateData}");
  • To address this issue and prioritize GitHub Copilot’s suggestions, I’ve already enabled the setting "Disable ReSharper automatic completion while GitHub Copilot suggestion is shown." My expectation is that, when I press the "Tab" key to accept GitHub Copilot’s suggestion, it should be integrated into my code, and the ReSharper menu should close and not be used.

However, the problem arises when I press "Tab." Surprisingly, both ReSharper and GitHub Copilot simultaneously accept the suggestion. ReSharper follows its template for "if" statements, while GitHub Copilot appends some of its code, resulting in a tangled mess of unusable and conflicting code.

if (expr)
{
    
}                    Logger.Info($"GetNearestClimate returned: {climateData}");

What can I do to make sure that GitHub Copilot’s suggestions take precedence over ReSharper’s in these situations. How can I manage this conflict and ensure that GitHub Copilot’s code suggestions are consistently used while still benefiting from ReSharper’s valuable features, such as the entire context menu itself?

Preferably, Copilot would consume whenever I hit "Tab", while ReSharper would consume whenever I hit space or enter, as it already does – so just disabling the "Tab" functionality for ReSharper, however I was unsuccessful in finding such an option.

I have already looked into the settings and tried to both enable and disable the "Disable ReSharper automatic completion while GitHub Copilot suggestion is shown." option.

I have also tried looking into whether it is possible to disable the Tab key for ReSharper, but to no avail.

I would greatly appreciate any insights, tips, or workarounds without disabling features to address this issue. Thank you for your assistance.

2

Answers


  1. It happens to be a known issue – https://youtrack.jetbrains.com/issue/RSRP-491939. While we are working on the fix, I’d suggest switching from ReSharper completion to VS one in ReSharper | Options | Environment | IntelliSense | General.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search