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

Key bindings bug when multiple keyboards layouts configured in OS #7723

Closed
mileusna opened this issue Jun 15, 2016 · 9 comments
Closed

Key bindings bug when multiple keyboards layouts configured in OS #7723

mileusna opened this issue Jun 15, 2016 · 9 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug keybindings VS Code keybinding issues keyboard-layout Keyboard layout issues macos Issues with VS Code on MAC/OS X verified Verification succeeded
Milestone

Comments

@mileusna
Copy link

mileusna commented Jun 15, 2016

  • VSCode Version: 1.2.1
  • OS Version: OS X El Capitan

Steps to Reproduce:

  1. Press cmd+/ to comment the entire line using US keyboard layout
  2. If you have multiple keyboards layouts in your OS X, it will zoom out the letters in editor (wrong shortcut), even if your current keyboard is US

By looking at keybindings.json I found this info for keyboard layout:
"For your current keyboard layout press ⌘+-"
The problem is, my current keyboard layout is US and VSCode mixed that shortcuts and use alternative shortcuts on US keyboard layout.

Of course, same will happen with other shortcuts as well which have alternative keys for other languages layouts.

This is the new bug, I haven't experienced this with previous versions.

@alexdima alexdima added keybindings VS Code keybinding issues and removed workbench labels Jun 16, 2016
@alexdima
Copy link
Member

@mileusna VSCode caches the keyboard layouts it detects for as long as a window is open. Is your scenario switching between keyboard layouts while a VS Code window is open?

@mileusna
Copy link
Author

mileusna commented Jun 16, 2016

@alexandrudima I investigated this now, it appears that bug depends which layout is set on opening of VSCode:

  • If my lang is SR in OS X and I open the VSCode, when I switch to EN (I usually do programming with EN keyboard) it will use alternative shortcuts. Funny thing is that default, normal, shortcuts are active when your language is set to SR and alternative shortcuts are active when the EN is the language. It is up side down.
  • If EN lang is set on VS Code open, everything works as it should. When I switch to SR language alternative shortcuts are active and when I switch to EN normal shortcuts are active.

Yes, I do switch sometimes inside VSCode to local language to enter some string with local characters, but I done that before, then switch back to EN for programing and easier access to [] {} etc. that was not the problem until latest release. Even now it works fine if you open VSC with EN, and even now VCS active different shortcuts depending on kb layout, but if you open VSC with other kb active, shortcuts are messed up.

Edit: I usually open VSCode from command line with # code .

@alexdima alexdima added the bug Issue identified by VS Code Team member as probable bug label Aug 9, 2016
@alexdima alexdima added this to the Backlog milestone Aug 9, 2016
@kristianmandrup
Copy link

I'm having the same problem...

@alexdima
Copy link
Member

alexdima commented Nov 7, 2016

This is for now a limitation documented in http://code.visualstudio.com/docs/customization/keybindings#_keyboard-layouts

image

@ThePrimeagen
Copy link

ThePrimeagen commented Dec 2, 2016

This same problem exists when attempting to define a custom keybinding. If I start vscode in my specialized keyboard layout I am unable to make most keybinding shortcuts (constantly telling me its a different symbol for my layout). To get around this, after reading this thread, I open VSCode with US keyboard, set my bindings, then switch my keyboard. All works well with that work around.

Thought that might help for anyone attempting to set keybindings.


Update: I just realized that once I close VSCode, for keyboard shortcuts to work correctly i have to start my editor in US every time (a bit of a hassle).

@eproxus
Copy link

eproxus commented Jan 27, 2017

@michaelbpaulson I'm in the same situation. I use a custom layout and even though it is selected VSCode doesn't handle the Cmd+/ command correctly. Your "workaround" also works for me, but you are correct that it is a huge hassle.

@alexdima alexdima added the keyboard-layout Keyboard layout issues label Mar 1, 2017
@alexdima alexdima added the macos Issues with VS Code on MAC/OS X label Mar 13, 2017
@alexdima
Copy link
Member

I have validated that we now (i.e. after PR #22894 aka #17521 -- in today's Insiders build) detect correctly keyboard layout changes on OSX. The keybinding service refreshes its state (I have tried with launching VSCode under a German keyboard layout and then switching to US and cmd+/ correctly toggles line comment).

@alexdima alexdima modified the milestones: March 2017, Backlog Mar 24, 2017
@jrieken jrieken added the verified Verification succeeded label Mar 30, 2017
@RicardoEPRodrigues
Copy link

It seems this bug also affects Linux.

I found that VSCode doesn't look at the active keyboard layout, but instead it looks at the first available layout.

In Ubuntu it's possible to change the order of the Input Sources or Layout and putting English US first fixed the shortcuts.

@alexdima
Copy link
Member

alexdima commented Sep 1, 2017

@RicardoEPRodrigues you are correct, there are some limitations on Linux. You hint on the one that we detect the keyboard layout that X11 is aware of. i.e. the one setxkbmap -query returns. This and other limitations are documented here -- https://github.com/Microsoft/vscode/wiki/Keybindings#troubleshoot-linux-keybindings -- if anyone has any experience in this area, PRs for these limitations are most welcome.

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug keybindings VS Code keybinding issues keyboard-layout Keyboard layout issues macos Issues with VS Code on MAC/OS X verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

8 participants