Vscode: Neo keyboard layout: Some Keys stopped working

Created on 6 Apr 2017  ·  28Comments  ·  Source: microsoft/vscode

  • VSCode Version: Code 1.11.0 (9122ec4b1068bd391e41974f46a4b54c1b9c90f9, 2017-04-05T21:13:24.700Z)
  • OS Version: Linux x64 4.4.0-72-generic

Steps to Reproduce:

  1. Install and activate Neo keyboard layout
  2. Open any source file in VS code
  3. Put cursor somewhere in the file
  4. Press M4 key and hold. Press s key (see image)
  5. Instead of the cursor moving left, nothing happens

In the previous version of VSCode (1.10.2 8076a19fdcab7e1fc1707952d652f0bb6c6db331) this worked just fine .

tastatur_e4b png

bug help wanted keyboard-layout linux

Most helpful comment

I need some time to understand this keyboard layout. I will ping you in the coming days if you'd be kind enough to help me out. It is unlike anything I've seen.

Workaround to switch VS Code to dispatch based on key code again. Add the following setting:
"keyboard.dispatch": "keyCode" and restart VS Code

All 28 comments

Same issue for me. Issue keywords because I didn't find this issue at first: layer 4 arrow keys neo2 german keyboard layout.

Worked fine in 1.10, doesn't work in 1.11.

The shortcut editor in VSCode seems to identify the combination highlighted in the keyboard above as [IntlBackslash] i

It is not broken on windows and VSCode 1.11.0.
However, keymapping there is done by autohotkey which intercepts key presses and emits its own - AFAIK this is handled differently in linux.

I just ran git bisect. The first bad commit seems to be https://github.com/Microsoft/vscode/commit/d10239639bf9beaa6ea34125319103de3dce43cd (@alexandrudima )

# bad: [9122ec4b1068bd391e41974f46a4b54c1b9c90f9] Fix styling of release notes (fixes #23948)
# good: [8076a19fdcab7e1fc1707952d652f0bb6c6db331] debug: save all untitled non dirty files before debug start
git bisect start '1.11.0' '1.10.2'
# good: [40fecfaa77f01672e8a147be71f6f7ccb9cf8a12] fix mixin
git bisect good 40fecfaa77f01672e8a147be71f6f7ccb9cf8a12
# good: [9d2e0611f7f7750f02ec72c4d18a20b69c5bf8cf] #18095 :lipstick:
git bisect good 9d2e0611f7f7750f02ec72c4d18a20b69c5bf8cf
# bad: [7c223972367b8ade5362d738606f3b910d0fbb42] Fixes #19235: Wording in tasks warning message
git bisect bad 7c223972367b8ade5362d738606f3b910d0fbb42
# good: [378231183e815c8e8e6a73ad04fc40ec5058fdc5] Promise cancellation is slow. Use a timer instead since this may run many times.
git bisect good 378231183e815c8e8e6a73ad04fc40ec5058fdc5
# good: [f70b0b3ecb7f276c811b0f18c7a0bec3b03c11a6] Fixes #22069: Define extension story for tasks
git bisect good f70b0b3ecb7f276c811b0f18c7a0bec3b03c11a6
# bad: [4ad4bd0d8011a5db5e2bea4543b7efb03d482aad] :bug: add commit box message
git bisect bad 4ad4bd0d8011a5db5e2bea4543b7efb03d482aad
# bad: [9003dbc3f5f2b87cb3cc4a3418030dbdc45ac0a3] Add IKeybindingService.resolveUserBinding
git bisect bad 9003dbc3f5f2b87cb3cc4a3418030dbdc45ac0a3
# bad: [968da131589845b43c0d00141b41b2bb366a84e8] Improve the ScanCode -> KeyCode guessing strategy
git bisect bad 968da131589845b43c0d00141b41b2bb366a84e8
# bad: [969cbdfea05beda1a38d4082698b87f239fc2384] Renames
git bisect bad 969cbdfea05beda1a38d4082698b87f239fc2384
# bad: [8a33db65efdd3ed4c76d01cb76c3ef658caf16db] Add Inspect Key Mapppings action
git bisect bad 8a33db65efdd3ed4c76d01cb76c3ef658caf16db
# bad: [0ebecd5ca915ed33ea747cafe2c99572c52904b5] Merge branch 'master' into alex/keybinding
git bisect bad 0ebecd5ca915ed33ea747cafe2c99572c52904b5
# bad: [d10239639bf9beaa6ea34125319103de3dce43cd] First cut at integrating keyboard mappers
git bisect bad d10239639bf9beaa6ea34125319103de3dce43cd
# first bad commit: [d10239639bf9beaa6ea34125319103de3dce43cd] First cut at integrating keyboard mappers

I need some time to understand this keyboard layout. I will ping you in the coming days if you'd be kind enough to help me out. It is unlike anything I've seen.

Workaround to switch VS Code to dispatch based on key code again. Add the following setting:
"keyboard.dispatch": "keyCode" and restart VS Code

I have the same issue on Debian/Jessie.

https://github.com/Microsoft/vscode/issues/25797

I have problems with the backspace.

Hi, I have the same problem. Yesterday the workaround worked for me, but today it's not working anymore. It works for around 2 seconds after editor startup, then my basic keys (letters) don't work anymore. :thinking:
I'm not sure if I did something stupid since yesterday, but do have any idea why this could be?

@zommerfelds The first thing I would check are the settings.json. Is the "keyboard.dispatch" duplicated in there, is the setting overwritten by a workspace setting when opening a folder, etc.

The next thing to look at is opening an editor and running F1 > Developer: Inspect key mappings. Does it print "FallbackKeyboardMapper dispatching on keyCode" (an indicator that the setting was applied).

If this is not a problem with the settings, i.e. the confirmation that dispatching is done on keyCode is there, then I'd try looking into what Electron/Chromium/the OS sends our way when you press a specific key: Please hover over the input box and take a screenshot:
keyboard-input

Hi @alexandrudima, thanks for the detailed answer.

cat ~/.config/Code/User/settings.json:

// Place your settings in this file to overwrite the default settings
{
    "keyboard.dispatch": "keyCode"
}

If I open the editor and go to _File => Preferences => Settings_, I see the same contents for _USER SETTINGS_ as above, and {} for _WORKSPACE SETTINGS_, so that should be fine.

_F1 > Developer: Inspect key mappings_ gives me:

Layout info:
{
    "model": "pc105",
    "layout": "de,ch",
    "variant": "neo,",
    "options": "grp:menu_toggle",
    "rules": "evdev"
}
FallbackKeyboardMapper dispatching on keyCode

Raw mapping:
...

For the keybindings I get:

If I want to type "a":
image

If I want to type "(":
image

The a printed just fine in that popup, but not in the main editor.

In Neo, the A is where the D key would be in QWERTY, and ( is CapsLock+J in QUERTY.
I can use the arrow keys in 4th layer in Neo just fine, but not for example the digits. Backspace works. Enter doesn't work. Ctrl+Z works for undo (in Neo).

Also, as I said earlier, everything works for the first few seconds while Vscode is starting up, then it stops working.

Let me know if I can help in some other way. It would be awesome if I could start using Vscode again :)

EDIT: for clarification I think I might not have the same problem as the OP. My arrows keys in the 4th layer work but not the plain and simple letter keys.

EDIT2: _Help => About_:

Version 1.12.2
Commit 19222cdc84ce72202478ba1cec5cb557b71163de
Date 2017-05-10T13:16:25.899Z
Shell 1.6.6
Renderer 56.0.2924.87
Node 7.4.0

Thanks @alexandrudima ! Changing "keyboard.dispatch": "code" to "keyboard.dispatch": "keyCode" in File->Preferences->Settings helped me to get the m4 layer keys (escape key, navigation keys, backspace, delete, numbers) working.

Still doesn't work for me on 1.19.0.
I also noticed that the keyboard.dispatch setting doesn't make a difference. In either setting, navigation keys and backspace for example work, but not digits and normal letters.
Is there a way for me to verify that vscode is actually loading it as keyCode and not falling back to code somehow?

Actually I just got it to work! The NeoX extension was messing up my settings. Disabling it fixed the issue. I have no idea anymore why I installed this extension nor what it does. I still have to set keyboard.dispatch to keyCode for it to work.
Sorry about that and thanks for the support. Yay I can use vscode now! :)

I guess we can close this issue then?

Issue is still present in current VS Code:

  • VS Code version: Code 1.20.0 (c63189deaa8e620f650cc28792b8f5f3363f2c5b, 2018-02-07T17:10:15.949Z)
  • OS version: Linux x64 4.13.0-32-generic

I've also had trouble using the Neo-Layout with VS Code 1.201 under Ubuntu 17.10 (Linux 4.13.0-36-generic). Without the "keyboad.dispatch": keyCode - switch I was able to type with Neo2 but couldn't even use CTRL + C and CTRL + V as it would map back to the default layout (triggering CTRL + R and CTRL + W, respectively).

well I just tried the "keyboard.dispatch" and it tells me "unknown configuration setting". But my problems are a bit different though.

Arrow keys work fine, but for example the undo key doesn't work. When I press M4+z visual studio code only recognizes z. And when I want to bind something to keys like äöü, vscode translates those keys if it would have been a US keyboard. So Ctrl+ü is recognized as Ctrl+z. This is horrible.

I do map my keyboard with XKB program to use modified dvorak keyboard.

I use ralt_switch option, which used to switch right alt key to function as meta key or extra modifier.
I do enable keyCode setting in VSCode Insider.
Below are my XKB setup sample

image

The RAlt (aka Meta key) + s recognized by VS as End key. +Good
but when I supposed to do ctrl+End key with Ctrl+RAlt (Meta)+s it recognized as Ctrl+s which will save the document. -Bad
Guess what happen when I tried to jump some words by pressing Ctrl+Right aka Ctrl+RAlt (Meta)+n several times.

I suppose Ctrl modifier does not play nice with extra modifier (or keyCode-ed modifier) like meta key or Mod4.
Even Ctrl+Shift+RAlt (Meta)+s does save as too.
But Shift+Ralt (Meta)+s does like Shift+End which is +Good
Can you just make ctrl behave like shift, in term in combining modifiers?


I think it is related issue, but with different case.
_the title mention neo layout, this one is custom_

does this related to this solved comment?
by using keyboard.dispatch 'code', but only for OSX. And I just tried it didnt work in Linux Mint/Ubuntu
https://github.com/Microsoft/vscode/issues/12393#issuecomment-288994081

I am on Linux.

Version 1.21.1
Commit 79b44aa704ce542d8ca4a3cc44cfca566e7720f1
Datum 2018-03-14T14:46:30.761Z
Shell 1.7.9
Renderer 58.0.3029.110
Node 7.9.0
Architektur x64

Unfortunately the keyboard.dispatch workaround seems not to work for me as well - at least not good enough. I can use the re-purposed CapsLock (Mod3) to insert programmers symbols like /,\,[,] and so forth within the editor, but not in Shortcuts like shift+/ which translates to pressing the physical buttons of shift+capslock+s

Trying to re-assign shortcuts with Mod3 shows unknown

unknown_key

It seems like @sakasistem mentioned, there seems to be issues with a certain sequence of modifier keys.

shortcuts like shift+/ are total BS and should not exist.

It should be either ? and let the layout decide what modifiers are needed to type that character, or a layout independend shift + scancode_slash. In the first option I would simply type ? (no matter where I put that on my layout and what modifiers I need to press), and in the second one I would just type a capital Jin my layout, because I have a J at the keyboard position where US qwerty has a /.

Much like with krux02, I had to type 'Ctrl+ü' and 'Ctrl+k' for undo and redo, respectively, but I was able to find the appropriate "keyboard.dispatch" setting and that seems to have solved the problem.

OS: Ubuntu 18.04 LTS

VSCode:

Version 1.23.1
Commit d0182c3417d225529c6d5ad24b7572815d0de9ac
Date 2018-05-10T16:04:33.747Z
Shell 1.7.12
Renderer 58.0.3029.110
Node 7.9.0
Architecture x64

Oh my, I am using vscode insider just to wait this issue to be fixed up.
Just like @sakasistem
I use thinkpad with physical qwerty keyboard, modify my keymap to custom dvorak with xkb file on linux mint sonya

Here is the keymap file https://pastebin.com/cUAxDtAM
It is for debian based OS, Linux Mint to be exact.
Put it in /usr/share/X11/xkb/symbols/us right before dvorak-intl definition
partial alphanumeric_keys xkb_symbols "dvorak-intl" {

It adds navigation magics to dvorak layout, it will behave up, left, down, right with RAlt+c,RAlt+h,RAlt+t,RAlt+n (it should be i, j, k, l on qwerty instead of c, h, t, n), it really works on most application with ctrl, shift and alt modifier, but vscode. Ctrl+RAlt+n should jump next word but instead it behave like Ctrl+n and open up new tab.

Shift modifier does work, which makes Shift+RAlt+s will select to the end of line, it just Ctrl modifier that trigger shortcut for the first place.

Well, here is the pastebin content:

partial alphanumeric_keys
xkb_symbols "dvorak-shy" {

    name[Group1]= "English (Dvorak) by Shy";

    key <TLDE> { [       grave, asciitilde, dead_grave, dead_tilde  ] };

    key <AE01> { [      1,  exclam      ]   };
    key <AE02> { [      2,  at      ]   };
    key <AE03> { [      3,  numbersign  ]   };
    key <AE04> { [      4,  dollar      ]   };
    key <AE05> { [      5,  percent     ]   };
    key <AE06> { [      6,  asciicircum, dead_circumflex, dead_circumflex ] };
    key <AE07> { [      7,  ampersand   ]   };
    key <AE08> { [      8,  asterisk    ]   };
    key <AE09> { [      9,  parenleft,  dead_grave] };
    key <AE10> { [      0,  parenright  ]   };
    key <AE11> { [ bracketleft, braceleft   ]   };
    key <AE12> { [ bracketright, braceright,  dead_tilde] };

    key <AD01> { [  apostrophe, quotedbl, dead_acute, dead_diaeresis    ] };
    key <AD02> { [  comma,  less,   dead_cedilla, dead_caron    ] };
    key <AD03> { [      period, greater, dead_abovedot, periodcentered  ] };
    key <AD04> { [      p,  P       ]   };
    key <AD05> { [      y,  Y       ]   };
    key <AD06> { [      f,  F       ]   };
    key <AD07> { [      g,  G, Page_Up, Page_Up     ]   };
    key <AD08> { [      c,  C, Up, Up       ]   };
    key <AD09> { [      r,  R, dead_tilde, dead_tilde       ]   };
    key <AD10> { [      l,  L       ]   };
    key <AD11> { [  slash,  question    ]   };
    key <AD12> { [  equal,  plus        ]   };

    key <AC01> { [      a,  A       ]   };
    key <AC02> { [      o,  O       ]   };
    key <AC03> { [      e,  E       ]   };
    key <AC04> { [      u,  U       ]   };
    key <AC05> { [      i,  I       ]   };
    key <AC06> { [      d,  D, Home, Home       ]   };
    key <AC07> { [      h,  H, Left, Left       ]   };
    key <AC08> { [      t,  T, Down, Down       ]   };
    key <AC09> { [      n,  N, Right, Right     ]   };
    key <AC10> { [      s,  S, End, End     ]   };
    key <AC11> { [  minus,  underscore  ]   };

    key <AB01> { [   semicolon, colon, dead_ogonek, dead_doubleacute ] };
    key <AB02> { [      q,  Q       ]   };
    key <AB03> { [      j,  J       ]   };
    key <AB04> { [      k,  K       ]   };
    key <AB05> { [      x,  X       ]   };
    key <AB06> { [      b,  B       ]   };
    key <AB07> { [      m,  M, Page_Down, Page_Down     ]   };
    key <AB08> { [      w,  W       ]   };
    key <AB09> { [      v,  V       ]   };
    key <AB10> { [      z,  Z       ]   };

    key <BKSL> { [  backslash,  bar             ]       };


    key <CAPS> { [    BackSpace,    BackSpace,       BackSpace,        BackSpace ] };

    include "level3(ralt_switch)"
};

pay atention to magical code include "level3(ralt_switch)" that makes RAlt like mod3 but makes vscode recognizes it as unknown.

Linux here, not using an unusual keyboard layout, I only remapped Caps Lock to Backspace via XkbOptions, and that didn't work either. Switching to keyCode made it work. I guess this affects any kind of key mapping.

For me the colon : spontaneously stopped working in Visual Studio Code 1.32.3 on macOS 10.14.3. The key combination in Neo2 is caps lock + ; (on qwerty). Setting keyboard.dispatch to keyCode helped.

Another neo2 user here ;) Stumbled across the backspace-not-working issue within the first few minutes of using VSCode. Luckily the workaround works like a charm so far!
Nevertheless it would be great if this bug was fixed some day ;)

The workaround from https://github.com/microsoft/vscode/issues/24043#issuecomment-292334048 works for the backspace functionality ( :+1: ) but moving one word forwards/backwards and deleting one word in front or behind the cursor still doesn't work :confused: , i.e. Ctrl + Alt Gr + w (in qwerty layout / keys on keyboard) should delete one word left of the cursor but just pastes the clipboard, which would be Ctrl + w (in qwerty layout / keys on keyboard) which is Ctrl + v.
It seems like the Alt Gr key press is just ignored when pressing the Ctrl key.

I'm using Arch Linux with the latest updates.

How can I provide more info to help resolve this issue?

I'm new to VS Code and I use the KOY layout (with some adaptions) on Linux (setxkbmap de koy). Same problem as with Neo2: I can type a hyphen by pressing CapsLock+L in the editor. But shortcuts containing CapsLock don't work (like zooming out with Ctrl+- = Ctrl-CapsLock-L).

The keybindings issues page recommends running F1 > Developer: Inspect key mappings if nothing else helps.

With the standard German layout (setxkbmap de), I get this for the L key:

    "KeyL": {
        "value": "l",
        "withShift": "L",
        "withAltGr": "ł",
        "withShiftAltGr": "Ł"
    }

With KOY (setxkbmap de koy), I get:

    "KeyL": {
        "value": "n",
        "withShift": "N",
        "withAltGr": "n",
        "withShiftAltGr": "N"
    },

Apparently, VS Code doesn't get the higher levels of the layout right!

Some additional technical information about this keyboard layout family (neo, adnw, koy, bone):

In the German default layout, AltGr is mapped to ISO_Level3_Shift (in Linux). In Neo2 (and alike), AltGr is mapped to ISO_Level5_Shift and CapsLock is mapped to ISO_Level3_Shift.

So I think, we should see in the output of > Developer: Inspect key mappings either

    "KeyL": {
        "value": "n",
        "withShift": "N",
        "withAltGr": "-",

(because CapsLock replaces AltGr in Neo2 in terms of being the new ISO_Level3_Shift key)

or

    "KeyL": {
        "value": "n",
        "withShift": "N",
        "withAltGr": "6",

(because you get a "6" when you press the physical AltGr key plus the L key as you can see in OP's screenshot).

I hope, this helps you VS Code developers better understanding our problem.

I'm aware that I (and others) are mixing some issues concerning Neo here. But they might be related.

Tested on Ubuntu 18.04 with this version of VS Code/Codium:

Version: 1.44.0
Commit: 2aae1f26c72891c399f860409176fe435a154b13
Date: 2020-04-09T10:44:46.342Z
Electron: 7.1.11
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Linux x64 4.15.0-96-generic

It seems like the Alt Gr key press is just ignored when pressing the Ctrl key.

I'm having the same problem. Marking single letters via Shift + RightArrow works when I enter the RightArrow via AltGr + E, But using Ctrl + Shift + RightArrow with the Neo-layout dispatches Ctrl + Shift + E instead.
I've used the key recording functionality and get with dispatch method code:

  • Pressing Shift + AltGr + E would first display shift + alt, then turns into shift + right.
  • Pressing Ctrl + Shift + AltGr + E first displays ctrl + shift + alt, then turns into ctrl + shift + e

and with method keyCode:

  • Pressing Shift + AltGr + E would first display shift + oem_8, then turns into shift + right.
  • Pressing Ctrl + Shift + AltGr + E displays ctrl + shift + oem_8 ctrl+shift+e

The same happens when just using Ctrl + AltGr +E which becomes ctrl + e instead of ctrl + right.

For this specific issue, would it perhaps be a feasible workaround to just mark a certain key as dead? Layouts like Neo don't need VSCode to listen to AltGr at all, it should only process the keycode that gets dispatched when pressed in combination. Moreover, when that layer is „locked” by using both Mod4 keys, pressing Ctrl + Shift + e is correctly recognised as ctrl + shift + right.

My layout info:

"layout": {
        "model": "pc105",
        "layout": "de,de,gb",
        "variant": "neo,,",
        "options": "grp_led:scroll,altwin:alt_super_win",
        "rules": "evdev"
    }

I had the same problem as described here multiple times, where holding control or similar keys makes certain keys in level 4 of the neo layout unusable and executes unwanted shortcuts.

My fix/workaround

What has worked for me in Ubuntu 18.04 and fixed all these problems, is to run setxkbmap -layout de -variant neo after startup and each wakeup. It seems to work with either setting for keyboard.dispatch (keyCode or code).

Startup

In "Startup Application Preferences"->Add enter setxkbmap -layout de -variant neo like this and save Screenshot

Wakeup

With sudoedit /lib/systemd/system-sleep/setxkbmap add

#!/bin/bash
case $1 in
  post)
    DISPLAY=:1 ; export DISPLAY
    su $USER -c "sleep 1; setxkbmap -layout de -variant neo"
  ;;
esac

and give executable permissions with sudo chmod 755 /lib/systemd/system-sleep/setxkbmap.

  • Instead of $USER add your user.
  • Everywhere else I have found DISPLAY=:0 suggested, but that didn't work for me. Then I tried the value I got from echo $DISPLAY (:1), which worked.
  • If it doesn't work, try with a longer delay (e.g. instead of sleep 1;, use sleep 3;)

I hope this helps others!

Was this page helpful?
0 / 5 - 0 ratings