skip to Main Content

Since last update (V1.77.0) the Enter key doesn’t work to create a line break in VS Code editor.

Anybody else experience the same?

3

Answers


  1. Chosen as BEST ANSWER

    I figured out the solution.

    In the keyboard shortcuts JSON (keybindings.json file) I added this:

    {
      "key": "enter",
      "command": "type",
      "args": {
      "text": "n"
    },
      "when": "editorTextFocus && !suggestWidgetVisible"
    },
    

    Now the Enter key works as expected in the code editor.


  2. Also check this github issue: Enter key is not working. (And https://github.com/microsoft/vscode/issues/178788)

    The vscode-styled-components extension has been identified by a few people as the problem.


    From the issue:

    This problem indeed is caused by the
    diegolincoln.vscode-styled-components extension because of the new VS
    Code when-clause parser.

    I tried sending a PR to this extension fixing the syntax error it has
    (which was just ignored by the previous parser), but it seems the
    extension (at least its repository) is archived. It seems like there’s
    a new vscode-styled-components extension that’s very popular –
    https://marketplace.visualstudio.com/items?itemName=styled-components.vscode-styled-components

    Workarounds Option 1 (recommended)

    This particular extension seems unmaintained. I strongly suggest
    switching to using this extension if it fits your needs –
    https://marketplace.visualstudio.com/items?itemName=styled-components.vscode-styled-components

    Option 2

    Remove that keybinding: invoke "Preferences: Open Keyboard Shortcuts"
    from the Command Palette, search "enter", and right-click on the
    command contributed by vscode-styled-components (see right-most column
    for the source of the keybinding)

    change old keybinding

    I will close this issue because this extension is unmaintained. I
    recommend switching to
    https://marketplace.visualstudio.com/items?itemName=styled-components.vscode-styled-components,
    which seems to be very active and fixes this keybinding in several
    ways (both the syntax error and integration with auto-completion)

    Login or Signup to reply.
  3. enter image description here

    Just Disable this extension and it will be fixed

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