daniellansun commented on PR #2976: URL: https://github.com/apache/groovy/pull/2976#issuecomment-6373420569
> Could we make the completion shortcut configurable? > > On my Swedish keyboard, "/" requires Shift+7, so Alt+/ is awkward. Since "isCompletionChord()" explicitly rejects Shift, I’m also wondering whether it would work with this layout. > > I understand why Ctrl+Space is avoided as the default, but being able to choose it, or another shortcut, would be useful. Thank you for pointing this out. Both parts are in place. The default remains Alt+/. Ctrl+Space is still not the default, because it switches the input method. An extra Shift is accepted only when the event's character is already `/`, which is how a Swedish Shift+7 is reported when the platform fills `keyChar` (`VK_7` or `VK_SLASH`). A press that has no character does not open completion by itself; the following typed `/` does. A US Alt+Shift+/ types `?` and does not complete, including when the press carries no character. Ctrl+Shift+Space is not Ctrl+Space. On macOS, Swedish Option+Shift+7 types `\`, so the default chord does not fire there; `ctrl SPACE` (or another stroke) is the way to choose a binding. `View -> Completion Shortcut...` stores another stroke in the `completionShortcut` preference. The value is a Swing key-stroke string, for example `ctrl SPACE` or `alt shift SLASH`. An unrecognised string is declined and the previous binding is kept. A missing or invalid preference falls back to `alt SLASH`. The matching rules live in `CompletionChord`, covered by `CompletionChordTest` (default chord, Swedish Shift+`/`, Swedish Shift+7, US `?`, Ctrl+Space, an explicit Shift binding, letters, and legacy modifier masks). The same helper is what the editor uses on key press and key release, so the character typed by the shortcut is still swallowed and the next key is not. This is described in the Groovy Console user guide under the completion paragraph. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
