-
Notifications
You must be signed in to change notification settings - Fork 423
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
Smart Semicolon Detection issue with Swiss German Keyboard #3290
Comments
That's weird, the command is properly bound to In any case you can disable the smart semicolon feature with |
Thanks for the quick reply. Yes I know this is weird but all I can say is that even when I reset the keybinding now the default value I get is this: So the default for me is "ü" instead of ";" -> I can manually adjust it again to ";" (or to be more precise [Shift]+[,]) and it will work (so this is not an urgent issue) but the default setting I get is definitely wrong, therefore I just wanted to report it. |
All I can see from the logs is that for this particular key on my keyboard the received and converted event do not match: When pressing without modifiers: [info] [KeybindingService]: / Received keydown event - modifiers: [], code: BracketLeft, keyCode: 186, key: ü -> ü gets converted to ; With [AltGr] modifier: [info] [KeybindingService]: / Received keydown event - modifiers: [], code: BracketLeft, keyCode: 186, key: [ -> [ gets converted to ; So perhaps this conversion/mapping might have something to do with it? |
Yes this would actually be the correct keybinding as [Shift]+[,] on Swiss German layout is the semicolon character. I also checked the other keybindings from the package.json and they are all correct, it is just the semicolon one where I get a different default value. Really strange. |
That's some VS Code black magic. @jrieken any idea? |
I dont understand it either. I have a mac with a swiss german layout, everything seems fine for me. |
Checked my old Dell PC Keyboard and I see the "[" on the same key as the "ü". On the Mac, the mapping that's applied when I connect it, would still put the "[" onto the "5" though. So apparently I cannot replicate this with a Mac :( |
Some more info: I did a downgrade to 1.21 and then went back to 1.22 which did not change anything. Configuring java.edit.smartSemicolonDetection.enabled only changes the location of the semicolon added but has no effect on the bug itself. So no matter if set to true or false I always get a semicolon when pressing ü, the semicolon only appears at cursor location or at the end of the line depending on the setting (at least the positioning part makes sense). |
It's better to avoid intercept VS Code supports checking a setting in a when clause, see https://code.visualstudio.com/api/references/when-clause-contexts#check-a-setting-in-a-when-clause, so we can append Lines 1323 to 1326 in 5347cc2
|
@snjeza instead of using a keybinding, can we use something like that instead? : window.onDidChangeTextDocument((event) => {
if (!smartSemicolonDetection()){
return;
}
const typedCharacter = getTypedCharacter(event);
if (typedCharacter === ';') {
commands.executeCommand('java.edit.smartSemicolonDetection.command');
//or call the function directly
}
}); |
@SKSniperSK @turkmenugur @polcamps we've released 1.22.1, which now properly respects "java.edit.smartSemicolonDetection.enabled:false", so you can safely disable this feature until it's properly fixed |
@fbricon |
When editing a Java file in VS Code using a Swiss German Keyboard I can not enter [ü] or [AltGr]+[ü] (which is left square bracket) because java.edit.smartSemicolonDetection.command is fired.
Environment
Steps To Reproduce
Keybinding logs:
When pressing [ü]:
2023-09-13 17:28:52.958 [info] [KeybindingService]: / Soft dispatching keyboard event
2023-09-13 17:28:52.978 [info] [KeybindingService]: | Resolving ;
2023-09-13 17:28:52.978 [info] [KeybindingService]: \ From 1 keybinding entries, matched java.edit.smartSemicolonDetection.command, when: editorTextFocus && javaLSReady && !editorReadonly && editorLangId == 'java', source: user extension redhat.java.
2023-09-13 17:28:52.978 [info] [KeybindingService]: / Received keydown event - modifiers: [], code: BracketLeft, keyCode: 186, key: ü
2023-09-13 17:28:52.979 [info] [KeybindingService]: | Converted keydown event - modifiers: [], code: BracketLeft, keyCode: 85 (';')
2023-09-13 17:28:52.979 [info] [KeybindingService]: | Resolving ;
2023-09-13 17:28:52.979 [info] [KeybindingService]: \ From 1 keybinding entries, matched java.edit.smartSemicolonDetection.command, when: editorTextFocus && javaLSReady && !editorReadonly && editorLangId == 'java', source: user extension redhat.java.
2023-09-13 17:28:52.979 [info] [KeybindingService]: + Invoking command java.edit.smartSemicolonDetection.command.
When pressing [AltGr]+[ü] (which is "["):
2023-09-13 17:30:36.525 [info] [KeybindingService]: / Soft dispatching keyboard event
2023-09-13 17:30:36.525 [info] [KeybindingService]: \ Keyboard event cannot be dispatched
2023-09-13 17:30:36.525 [info] [KeybindingService]: / Received keydown event - modifiers: [ctrl], code: ControlLeft, keyCode: 17, key: Control
2023-09-13 17:30:36.525 [info] [KeybindingService]: | Converted keydown event - modifiers: [ctrl], code: ControlLeft, keyCode: 5 ('Ctrl')
2023-09-13 17:30:36.525 [info] [KeybindingService]: \ Keyboard event cannot be dispatched in keydown phase.
2023-09-13 17:30:36.525 [info] [KeybindingService]: / Soft dispatching keyboard event
2023-09-13 17:30:36.525 [info] [KeybindingService]: \ Keyboard event cannot be dispatched
2023-09-13 17:30:36.526 [info] [KeybindingService]: / Received keydown event - modifiers: [], code: AltRight, keyCode: 18, key: AltGraph
2023-09-13 17:30:36.526 [info] [KeybindingService]: | Converted keydown event - modifiers: [alt], code: AltRight, keyCode: 6 ('Alt')
2023-09-13 17:30:36.526 [info] [KeybindingService]: \ Keyboard event cannot be dispatched in keydown phase.
2023-09-13 17:30:36.637 [info] [KeybindingService]: / Soft dispatching keyboard event
2023-09-13 17:30:36.637 [info] [KeybindingService]: | Resolving ;
2023-09-13 17:30:36.637 [info] [KeybindingService]: \ From 1 keybinding entries, matched java.edit.smartSemicolonDetection.command, when: editorTextFocus && javaLSReady && !editorReadonly && editorLangId == 'java', source: user extension redhat.java.
2023-09-13 17:30:36.637 [info] [KeybindingService]: / Received keydown event - modifiers: [], code: BracketLeft, keyCode: 186, key: [
2023-09-13 17:30:36.638 [info] [KeybindingService]: | Converted keydown event - modifiers: [], code: BracketLeft, keyCode: 85 (';')
2023-09-13 17:30:36.638 [info] [KeybindingService]: | Resolving ;
2023-09-13 17:30:36.638 [info] [KeybindingService]: \ From 1 keybinding entries, matched java.edit.smartSemicolonDetection.command, when: editorTextFocus && javaLSReady && !editorReadonly && editorLangId == 'java', source: user extension redhat.java.
2023-09-13 17:30:36.638 [info] [KeybindingService]: + Invoking command java.edit.smartSemicolonDetection.command.
2023-09-13 17:30:36.986 [info] [KeybindingService]: + Storing single modifier for possible chord ctrl.
2023-09-13 17:30:36.987 [info] [KeybindingService]: + Clearing single modifier due to modifier mismatch: ctrl alt
This issue can be fixed manually by adjusting the "Java: Java Smart Semicolon Detection" keyboard shortcut in settings (change keybinding from [ü] to [Shift]+[,] (which is ";") but the default value [ü] makes no sense at all, so this should be fixed.
The text was updated successfully, but these errors were encountered: