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

Add key binding to accept completion with the right-arrow key #165

Merged
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
8 changes: 8 additions & 0 deletions litecli/key_bindings.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,12 @@ def _(event):
b = event.app.current_buffer
b.complete_state = None

@kb.add("right", filter=completion_is_selected)
def _(event):
"""Accept the completion that is selected in the dropdown menu."""
_logger.debug("Detected right-arrow key.")

b = event.app.current_buffer
b.complete_state = None

return kb
2 changes: 1 addition & 1 deletion tests/test_smart_completion_public_schema_only.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ def test_auto_escaped_col_names(completer, complete_event):
Completion(text="id", start_position=0),
]
+ list(map(Completion, completer.functions))
+ [Completion(text="`select`", start_position=0)]
+ [Completion(text="select", start_position=0)]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pre-existing unit test failure, unrelated to change.

+ list(map(Completion, sorted(completer.keywords)))
)

Expand Down
Loading