Disable the "refactor preview" confirmation tab

Viewed 489
2 Answers

Are you accidentally pressing Shift + Enter after renaming?

This behavior should only happen after you press F2, change the name of the item, and then press Shift + Enter. Pressing only enter should automatically perform the rename without the refactor preview tab opening. The rename box states this:

rename box

In case its not clear, here is a video that illustrates this.

Solution

  • First of all, you can try to disable Editor > Rename: Enable Preview in User/Workspace settings, and then perform Developer: Reload Window to see whether the problem still exists.

  • If you are using C/C++ entension, the problem maybe still exists. Then you can try disable its IntelliSense and replace with clangd extension's.

    1. Install clangd extension;
    2. A C/C++ extension bubble popup will ask you whether to disable its IntelliSense, and choose yes;
    3. Then everything would be fine, enjoy yourself!

Reason:

In C/C++ extension, to ensure the refactoring is safe, a preview tab is forced to appear when the refactoring may be ambiguous.

For example, if you have parameters in different functions with a same name:

int func1(int para){return 0;}
int func2(int para){return 0;}
int func3(int para3){int para = 0; return 0;}

then rename para in func1 with F2 and you can see the "conflicts": click to see.

In the process, renaming is accomplished by C/C++ extension, and the preview tab will still appear even Rename: Enable Preview is banned.

Related