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

feat(hotkeys): add configurable completion selection movement #3475

Merged
merged 2 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/guides/editor_features/hotkeys.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ You can find a list of available hotkeys below:
| `cell.unfold` |
| `cell.unfoldAll` |
| `cell.viewAsMarkdown` |
| `completion.moveDown` |
| `completion.moveUp` |
| `global.commandPalette` |
| `global.focusBottom` |
| `global.focusTop` |
Expand Down
6 changes: 2 additions & 4 deletions frontend/src/core/codemirror/cm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,7 @@ export const basicBundle = (opts: CodeMirrorSetupOpts): Extension[] => {
preventDefault: true,
},
{
key: "Alt-j",
mac: "Ctrl-j",
key: hotkeys.getHotkey("completion.moveDown").key,
run: (cm) => {
if (completionStatus(cm.state) !== null) {
moveCompletionSelection(true)(cm);
Expand All @@ -185,8 +184,7 @@ export const basicBundle = (opts: CodeMirrorSetupOpts): Extension[] => {
preventDefault: true,
},
{
key: "Alt-k",
mac: "Ctrl-k",
key: hotkeys.getHotkey("completion.moveUp").key,
run: (cm) => {
if (completionStatus(cm.state) !== null) {
moveCompletionSelection(false)(cm);
Expand Down
10 changes: 10 additions & 0 deletions frontend/src/core/hotkeys/hotkeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,16 @@ const DEFAULT_HOT_KEY = {
group: "Navigation",
key: "F12",
},
"completion.moveDown": {
name: "Move completion selection down",
group: "Editing",
key: "Ctrl-j",
},
"completion.moveUp": {
name: "Move completion selection up",
group: "Editing",
key: "Ctrl-k",
},
} satisfies Record<string, Hotkey>;

export type HotkeyAction = keyof typeof DEFAULT_HOT_KEY;
Expand Down
Loading