Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Keyboard shortcut for code action refactor.extract.function fails when the menu action works. #7454

Open
dibarbet opened this issue Aug 19, 2024 · 1 comment
Labels

Comments

@dibarbet
Copy link
Member

Originally filed by @rilehudd at microsoft/vscode-dotnettools#1335

Describe the Issue

Activating a key-binding to extract a method (using C#) does not extract the method. Though the code action does work if you do it through the right click menu.

Steps To Reproduce

Reproduction steps:

  1. Install C# Dev Kit extension.
  2. Setup key-binding for "Extract Method" (per https://code.visualstudio.com/docs/editor/refactoring#_keybindings-for-code-actions)
  3. Attempt to use hotkey to extract code into a method.
public class Program
    {
        public static void Main()
        {
            // Highlighting from here
            for (int i = 0; i < 10; i++) 
            {
                Console.WriteLine("Test" + i);
            }
            // to here
        }
    }

The hotkey fails with tooltip: "No code actions for 'refactor.extract.function' available"

Expected Behavior

The action to extract a method via a hotkey (step 3) does not work (unexpected).
If you use the UI menu instead of a keyboard shortcut to extract into a method ("Right Click -> Refactor -> Extract Method") the functionality does succeed.

Environment Information

Edition Windows 11 Enterprise
Version 23H2
Installed on ‎7/‎13/‎2023
OS build 22631.3880
Experience Windows Feature Experience Pack 1000.22700.1020.0

Version: 1.93.0-insider
Commit: 3b27f1f74bc09fe2e2068997fcd42768be44a4e3
Date: 2024-08-02T05:03:53.254Z
Electron: 30.1.2
ElectronBuildId: 9870757
Chromium: 124.0.6367.243
Node.js: 20.14.0
V8: 12.4.254.20-electron.0
OS: Windows_NT x64 10.0.22631

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant