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

Visual Studio Code: '/' being considered as CtrlRight, so toggle line comment can't be used, doesn't work #114275

Closed
afa7789 opened this issue Jan 13, 2021 · 16 comments
Assignees
Labels
keyboard-layout Keyboard layout issues linux Issues with VS Code on Linux upstream Issue identified as 'upstream' component related (exists outside of VS Code)

Comments

@afa7789
Copy link

afa7789 commented Jan 13, 2021

  • VSCode Version: 1.52.1
  • OS Version: Pop_OS! 20.0.4

Steps to Reproduce:

  1. Try to use toggle comment doesn't recognize my '/' as ForwardSlash, troubleshoot show it's reading and right control
  2. Can't Re assign the same shortcut because it doesn't read th character

Does this issue occur when all extensions are disabled?: Yes

I'm on Pop_OS! 20 and am using Visual Studio Code 1.52.1.
Keyboard Layout : Portuguese, Brazil , IBM/Lenovo Thinkpad
And I'm using a t460. Keyboard Image.

I can't use the shortcut for commenting anymore ctrl +/ it simply stopped working.

While typing around on the VS Code i can type "/" and use ctrl correctly, most of shortcuts seem to be fine.

But when trying to assigning a new shortcut ,for the toggle line command, it doesn't accept my '/' key as '/' when typed it say it is "ctrl". So if i try to asign ctrl + / it will remain as "ctrl +" image with what i'm describing. If i only type "/" it say it's "ctrl" too, what i'm supposed to do ? can i change the mapping to this key on VS Code ? Image with visual layout showing key typed test.

It's not accepting my keyboard layout to define new shortcuts it seems at least not with this key. I'm using a Brazil, IBM/Lenovo Thinkpad layout. And the machine keyboard i'm on is a thinkpad too...

keyboard troubleshot: (type 'ctrl' release key , type '/' released key, type 'ctrl' then type '/' then released '/' then released 'ctrl'.)

[2021-01-12 19:48:22.249] [renderer1] [info] [KeybindingService]: / Received  keydown event - modifiers: [ctrl], code: ControlLeft, keyCode: 17, key: Control
[2021-01-12 19:48:22.249] [renderer1] [info] [KeybindingService]: | Converted keydown event - modifiers: [ctrl], code: ControlLeft, keyCode: 5 ('Ctrl')
[2021-01-12 19:48:22.249] [renderer1] [info] [KeybindingService]: \ Keyboard event cannot be dispatched.
[2021-01-12 19:48:23.192] [renderer1] [info] [KeybindingService]: / Received  keydown event - modifiers: [], code: ControlRight, keyCode: 191, key: /
[2021-01-12 19:48:23.192] [renderer1] [info] [KeybindingService]: | Converted keydown event - modifiers: [], code: ControlRight, keyCode: 85 ('/')
[2021-01-12 19:48:23.192] [renderer1] [info] [KeybindingService]: \ Keyboard event cannot be dispatched.
[2021-01-12 19:48:34.483] [renderer1] [info] [KeybindingService]: / Received  keydown event - modifiers: [ctrl], code: ControlLeft, keyCode: 17, key: Control
[2021-01-12 19:48:34.483] [renderer1] [info] [KeybindingService]: | Converted keydown event - modifiers: [ctrl], code: ControlLeft, keyCode: 5 ('Ctrl')
[2021-01-12 19:48:34.484] [renderer1] [info] [KeybindingService]: \ Keyboard event cannot be dispatched.
[2021-01-12 19:48:36.976] [renderer1] [info] [KeybindingService]: / Received  keydown event - modifiers: [], code: ControlRight, keyCode: 191, key: /
[2021-01-12 19:48:36.976] [renderer1] [info] [KeybindingService]: | Converted keydown event - modifiers: [], code: ControlRight, keyCode: 85 ('/')
[2021-01-12 19:48:36.976] [renderer1] [info] [KeybindingService]: \ Keyboard event cannot be dispatched.
[2021-01-12 19:48:38.045] [renderer1] [info] [KeybindingService]: / Received  keydown event - modifiers: [ctrl], code: ControlLeft, keyCode: 17, key: Control
[2021-01-12 19:48:38.046] [renderer1] [info] [KeybindingService]: | Converted keydown event - modifiers: [ctrl], code: ControlLeft, keyCode: 5 ('Ctrl')
[2021-01-12 19:48:38.046] [renderer1] [info] [KeybindingService]: \ Keyboard event cannot be dispatched.
[2021-01-12 19:48:38.180] [renderer1] [info] [KeybindingService]: / Received  keydown event - modifiers: [ctrl], code: ControlRight, keyCode: 191, key: /
[2021-01-12 19:48:38.180] [renderer1] [info] [KeybindingService]: | Converted keydown event - modifiers: [ctrl], code: ControlRight, keyCode: 85 ('/')
[2021-01-12 19:48:38.181] [renderer1] [info] [KeybindingService]: \ Keyboard event cannot be dispatched.

Just realized it's considering my forward backslash or forward slash as ControlRight, but the layout used is the correct one.

@alexhausen
Copy link

I had a similar issue, but I believe my report is more detailed.
Please check #114592

@afa7789
Copy link
Author

afa7789 commented Jan 19, 2021

Interesting report, your workaround didn't actually helped me, since both of my layouts where pt-br i'm actually using an usb keyboard so i can use the ctrl + / , since this keyboard has a right control he doesn't confuse with the thinkpad actual key being pressed.

What leaves me more intrigged is that he knows that i'm typing '/' so why the hell it would interpret it as CtrlRight bullocks ...

@alexdima alexdima added keyboard-layout Keyboard layout issues linux Issues with VS Code on Linux labels Oct 13, 2021
@alexdima
Copy link
Member

@afa7789 Today's insiders contains a fix for #24166 . That would make it that we will read the correct active layout when VS Code is launched. Can you please try it?

@alexdima alexdima added the info-needed Issue requires more information from poster label Oct 13, 2021
@afa7789
Copy link
Author

afa7789 commented Oct 13, 2021 via email

@afa7789
Copy link
Author

afa7789 commented Oct 17, 2021 via email

@alexdima
Copy link
Member

@afa7789 Thank you for your time. You can download a zip version of the Insiders build from https://code.visualstudio.com/insiders/ (or you can install it side-by-side with the stable regular build)

@afa7789
Copy link
Author

afa7789 commented Oct 18, 2021 via email

@alexdima
Copy link
Member

alexdima commented Oct 19, 2021

@afa7789 On your Portuguese/Brazil keyboard you have a very special key, /? that is known to cause headaches to all software, because it is kind of unique to Portuguese/Brazil.


First of all, let me double check: Have you installed Linux natively (bare-metal) or are you using some form of virtualization / remote desktop ?


If you are sitting physically and Linux is installed directly on the machine, could you please try the following:

  1. Download and open https://www.electronjs.org/fiddle for you platform
  2. Load https://gist.github.com/deepak1556/69b8930b819f82115df50d0f466dd1ba via Load Fiddle button on the top right corner
  3. Choose Electron version v13.5.1 from top left dropdown
  4. Run the app
  5. With the input box focused, press Ctrl+/
  6. Take Screenshot

It would look something like this:
image


You can also try opening https://w3c.github.io/uievents/tools/key-event-viewer.html in Chromium and Firefox and we can look together if the events look good or something is broken in Chromium.

@afa7789
Copy link
Author

afa7789 commented Oct 21, 2021 via email

@alexdima
Copy link
Member

Attaching screenshots at #114275 :

First Screen shoot, made with external keyboard that is able to coment the code:
image


Second screenshot , with thinkpad native keyboard:
image


This is my Input source:

image


one last printscreen just to make sure.:
image

@alexdima
Copy link
Member

Thank you @afa7789

These screenshots nicely show the problem, looking at row #2 which is the actual ctrl+/ keydown event:

  • when you use the external keyboard, the code is correctly set to IntlRo.
  • when you use the native thinkpad keyboard, the code is incorrectly set to ControlRight.

Here is my opinion on what could be going wrong:

  • this might be a configuration error. Perhaps your configured keyboard layout "Portuguese (Brazil, IBM/Lenovo ThinkPad)" is correct for your external keyboard layout, but for your native thinkpad keyboard you need to use a different keyboard layout. Are there variations of the one you have selected now in Ubuntu?
  • perhaps Chromium has a bug in its internal mapping for IntlRo here, but IMHO that is pretty unlikely.

Thank you again for your help, but this is not a problem with VS Code itself, it is a problem either in Chromium or it is a configuration error. As a workaround, you can switch VS Code to dispatch on keyCode instead of code, using the setting "keyboard.dispatch": "keyCode" in VS Code. (It looks like the keyCode field in both screenshots is correct).

@afa7789
Copy link
Author

afa7789 commented Oct 22, 2021 via email

@afa7789
Copy link
Author

afa7789 commented Oct 22, 2021 via email

@alexdima
Copy link
Member

Adding image also to #114275

image

@alexdima
Copy link
Member

@afa7789 Thanks again for the information, I am happy that the workaround works for you. If you believe your configuration is correct, you can try to further pursue this issue with Chromium.

@alexdima alexdima added upstream Issue identified as 'upstream' component related (exists outside of VS Code) and removed info-needed Issue requires more information from poster labels Oct 22, 2021
@afa7789
Copy link
Author

afa7789 commented Oct 22, 2021 via email

@github-actions github-actions bot locked and limited conversation to collaborators Dec 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
keyboard-layout Keyboard layout issues linux Issues with VS Code on Linux upstream Issue identified as 'upstream' component related (exists outside of VS Code)
Projects
None yet
Development

No branches or pull requests

3 participants