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

Expand PSReadLine MenuComplete to work in Visual Studio Code for non-english default languages #1086

Closed
WorrenB opened this issue Oct 5, 2019 · 19 comments
Labels
Issue-KeyboardLayout Issues related to dead keys with some keyboard layout. Issue-Usability Resolution-External

Comments

@WorrenB
Copy link

WorrenB commented Oct 5, 2019

this is my second issue on github.
I hope it is usable in this form.

PS version: 7.0.0-preview.4
PSReadline version: 2.0.0-beta5
os: 10.0.18362.356 (WinBuild.160101.0800)
PS file version: 7.0.0.0
HostName: Visual Studio Code Host
BufferWidth: 160
BufferHeight: 19

Behavior:
If windows default language is set to english the PSReadLine MenuComplete in Visual Studio Code - Insiders works out of the box as intended.

Completion functions
====================
Key           Function            Description
---           --------            -----------
Ctrl+@        MenuComplete        Complete the input if there is a single completion, otherwise complete the input by selecting from a menu of possible completions.
Ctrl+Spacebar MenuComplete        Complete the input if there is a single completion, otherwise complete the input by selecting from a menu of possible completions.

as my default language usually is set to german, I'm encountering problems while trying Ctrl+Space for calling MenuCompletion.
Ctrl+Space is then interpreted as ctrl+"
even switching keyboard layout then to english with Shift+Alt makes no difference.
Defining a additional PSReadLineKeyHandler s.b. fixed it for me, but due it works in english without any changes maybe there is a chance to "expand" it work for other languages too.

Set-PSReadLineKeyHandler -Chord 'Ctrl+"' -Function MenuComplete
Completion functions
====================
Key           Function            Description
---           --------            -----------
Ctrl+@        MenuComplete        Complete the input if there is a single completion, otherwise complete the input by selecting from a menu of possible completions.
Ctrl+Spacebar MenuComplete        Complete the input if there is a single completion, otherwise complete the input by selecting from a menu of possible completions.
Ctrl+"        MenuComplete        Complete the input if there is a single completion, otherwise complete the input by selecting from a menu of possible completions.

Thank you
kind regards
Björn

@msftrncs
Copy link
Collaborator

msftrncs commented Oct 7, 2019

Could this be a VS Code thing? Does it happen to in a normal ConHost'd PowerShell?

@WorrenB
Copy link
Author

WorrenB commented Oct 7, 2019

no it doesn't happen in ConHost'd Powershell - so maybe it is.
but this was also the case with english win default language until @TylerLeonhardt fixed it somehow.
so I thought it would be ok to place it here.
can you move it then - if needed?

@daxian-dbw
Copy link
Member

@TylerLeonhardt Do you remember how it was fixed with English being the default language?

@TylerLeonhardt
Copy link
Member

TylerLeonhardt commented Oct 7, 2019

Yes! I fixed it in #878 where I added Ctrl+@. I think as long as it doesn't conflict with anything, we can add Ctrl+".

That said... @Tyriar, do you know why Ctrl+Space would be interpreted differently in a German layout vs an English one?

@Tyriar
Copy link

Tyriar commented Oct 7, 2019

@TylerLeonhardt no idea. keyCode 32 (space) should send NUL (\u0000) to the shell:

https://github.com/xtermjs/xterm.js/blob/cad9477eef22c0e505337c1f634f9f35a8804edc/src/common/input/Keyboard.ts#L331

@daxian-dbw
Copy link
Member

I think as long as it doesn't conflict with anything, we can add Ctrl+".

I'm not sure if we want to go that way. It's possible Ctrl+Space gets mapped to a different chord for another different keyboard layout ...

@TylerLeonhardt
Copy link
Member

I'm not sure if we want to go that way.

Yes ideally we find a generic way of going about doing this but it's unclear who's causing the different behavior at this time. I know that PSReadLine has had an issue here and there in the passed wrt other keyboard layouts.

@WorrenB
Copy link
Author

WorrenB commented Oct 8, 2019

for me it is mysterious because, it somehow seems to make a difference which language is active before starting vscode while language switching in an open vscode doesn't change the behavior?

@daxian-dbw daxian-dbw added the Issue-KeyboardLayout Issues related to dead keys with some keyboard layout. label Mar 19, 2020
@daxian-dbw
Copy link
Member

Going through all keyboard layout issues.
@WorrenB I know it's been quite a while, but any chance you can try this with the latest PowerShell VS Code extension (2020.3.0) and see if it still happens? Also, can you please try the same in Windows Terminal? Look here for how to install it. Thanks!

@Livven
Copy link

Livven commented Mar 22, 2020

@daxian-dbw Not the person you mentioned but can confirm this is an issue with the latest versions of VS Code and Windows Terminal.

@daxian-dbw
Copy link
Member

daxian-dbw commented Mar 24, 2020

Thanks @Livven. We also got a new report (#1415) for the same issue with 2.0.0 GA PSReadLine in Windows Terminal.

From @l-c-g:

This may be related to #1380 (but I am already using PSReadLine 2.0) or #1086 (Windows Terminal and VS Code may share some code in this area, I don't know). It might also be related to microsoft/terminal#2865. From a comment in that issue, I understand that this is due to terminals handling Ctrl+Space as alias for Ctrl+@. Coincidentally, on a German keyboard you enter " as Shift+2, which is where the US layout has the @ glyph. This comment lead me to try and switch my keyboard layout to US; if I do, Ctrl+Space correctly invokes MenuComplete.

To me, it looks like a complex interaction between Windows Terminal, PSReadLine and the keyboard layout. I cannot say, however, whether the problem is in PSReadLine or Windows Terminal (in which case I would gladly open an issue with them).

@sigmarising
Copy link

Going through all keyboard layout issues.
@WorrenB I know it's been quite a while, but any chance you can try this with the latest PowerShell VS Code extension (2020.3.0) and see if it still happens? Also, can you please try the same in Windows Terminal? Look here for how to install it. Thanks!

My Computer Enviroment:

  • PS version: 7.0.2
  • PSReadline version: 2.1.0-beta2
  • OS: Windows10 2004(19041.329)
  • VSCode: 1.46.0 stable
  • Windows Terminal: 1.0.1401.0 stable

I also experience the Ctrl+Space not working with Chinese input. But after I use the screencast in VScode, I found this may caused by key-binding conflict with different language Inputs.

Test for diffrent inputs

I use Microsoft Chinese Pinyin (which can change EN/CN input by hitting keybind) Input all the time. When I test the Ctrl+Space in English (EN-US), Microsoft Janpanese, and Microsoft Chinese Input, I find that VSCode can not get the Space key when I using the Chinese Input.

Then I goto the settings of Microsoft Chinese Pinyin Input and find that it use the keybinding Ctrl+Space to change between EN/CN.

image

Then I disabled this key-bind, and Ctrl+Space works well with English, Janpanese, Chinese inputs both in Vscode and windows ternimal.

@daxian-dbw
Copy link
Member

A bunch of key bindings used in PSReadLine get fixed in the most recent preview release of Windows Terminal (v1.1.1671.0), including ctrl+space (which doesn't need the ctrl+@ workaround binding for MenuComplete anymore).
See microsoft/terminal#879 for the issue, and microsoft/terminal#879 (comment) for the release information.
@l-c-g Can you please install the preview version of Windows Terminal and see if Ctrl+Space works fine in the German keyboard as well?

@daxian-dbw
Copy link
Member

@Tyriar Given the issue microsoft/terminal#879 fixed in Windows Terminal preview release, can it also be fixed in VSCode terminal?

Ctrl+Space in Windows Terminal (1.1.1671.0)
image

Ctrl+Space in VSCode terminal (1.46.1)
image

@Tyriar
Copy link

Tyriar commented Jul 7, 2020

@daxian-dbw well if we just need to enable PSEUDOCONSOLE_WIN32_INPUT_MODE to get this then yes, it will be months before conpty ships in Windows 10 though.

@WorrenB
Copy link
Author

WorrenB commented Jul 12, 2020

Oh sorry - had a look on the progress of my issue at the beginning and then left without looking at it anylonger.
I will now read all your comments which came in meanwhile and answer questions if still open.

@WorrenB
Copy link
Author

WorrenB commented Aug 4, 2020

for me it is also

Ctrl+Space in Windows Terminal Version: 1.1.2021.0 shows
wt

Ctrl+Space in VSCode Version 1.48.0 Insider shows
VSCode Insider

so it seems to be interpreted correct in Windows Terminal while in VSCode it still shows something diffrent.

@sakaldevverm
Copy link

sakaldevverm commented Jan 13, 2024

Uploading Screenshot (57).png…
please soutout my problam

@daxian-dbw
Copy link
Member

@WorrenB It's been over 2.5 years since we last check on this issue. Given that this is rooted in VSCode terminal, not something we can fix in PSReadLine, I will close this issue. Can you please check again if the issue has been resolved in VSCode terminal? If not, can you please open an issue in the VSCode repository instead? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-KeyboardLayout Issues related to dead keys with some keyboard layout. Issue-Usability Resolution-External
Projects
None yet
Development

No branches or pull requests

8 participants