Search code examples
keyboardvisual-studio-2019

Forward slash key not working in VS2019 code editor


Since a few days (I don't know exactly when it started) the forward key in VS2019 is not working in the code editor. No matter how many times I press it, it doesn't do anything. It also doesn't work in the seach box in the menu bar (labelled 'Search (Ctrl+Q)') nor in the search box which appears with Ctrl+F. It does work in other places, like the solution explorer search box (Ctrl+;) and in the resource editor.

The forward slash is working in any other application that I tried (including Visual Studio Code and MS Excel). The question mark (Shift+/) is working everywhere, including in the code editor window. Even AltGr+/ is working (producing the Spanish upside down question mark).

I tried all other keys, including the AltGr combinations. They all work fine. Keyboard layout is US International.

The foward slash key doesn't work in the code editor when typing it on the laptop keyboard, and doesn't work when typing it on an external keyboard, or via an RDP session.

I am running Windows 10 Pro 64-bit, version 20H2, build 19042.685. System is up to date. Visual Studio Professional 2019, 16.8.3, also up to date.

What is causing the forward slash key to fail? How can I solve this problem?


Solution

  • (Too long for a comment.)

    The OP indicated that the problem was resolved after resetting the keyboard shortcuts, which suggests that / was set as a keyboard shortcut either by accident or perhaps by an installed extension.

    However, the question remains in such cases of how to identify what a particular keyboard shortcut is assigned to, in order to turn off just that one shortcut as opposed to resetting all.

    Visual Studio does not appear to provide a place to see the list of all active keyboard shortcuts. An alternative is to go to Tools / Import and Export Settings / Export Selected / All Settings and save a .vssettings file with all the current settings. That is a plain text file with extended XML sections, and the keyboard shortcuts can be found under the following node (reformatted for readability):

        <Category name="Environment_KeyBindings" ... >
          <Version>16.0.0.0</Version>
          <KeyboardShortcuts>
            <DefaultShortcuts>
              <Shortcut Command="View.ViewCode" Scope="Global">F7</Shortcut>
              ...
            </DefaultShortcuts>
            <UserShortcuts>
              ...
            </UserShortcuts>
          </KeyboardShortcuts>
        </Category>
    

    One of the <Shortcut> lines would have been listing / before the reset, and the Command attribute on that line indicated the assignment, so that it could be located and turned off individually in Tools / Options / Environment / Keyboard.