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

Allow customisation of the keys that trigger insertation of a completion #358

Merged
merged 4 commits into from
Jul 19, 2023

Conversation

zenonet
Copy link
Contributor

@zenonet zenonet commented Jul 18, 2023

Some people might not want to insert code completions using the enter key because they want to be able to create line breaks even when a completion window shows up. For example they might only want to insert completions using the tab key.

This PR adds a Key[] called CompletionAcceptKeys to the CompletionList Class. Now, when a keypress is handled by the completion list, it will check if the pressed key is is present in the CompletionAcceptKeys array instead of deciding based on the hard coded switch statement.

By default, this array will contain the Enter key and the tab key, so the behavior is unchanged.

@zenonet
Copy link
Contributor Author

zenonet commented Jul 18, 2023

@dotnet-policy-service agree

Copy link
Collaborator

@danipen danipen left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for the contribution. Can you please apply the requested changes just for code readability?

src/AvaloniaEdit/CodeCompletion/CompletionList.cs Outdated Show resolved Hide resolved
@zenonet
Copy link
Contributor Author

zenonet commented Jul 19, 2023

Done!

@zenonet zenonet requested a review from danipen July 19, 2023 13:03
Copy link
Collaborator

@danipen danipen left a comment

Choose a reason for hiding this comment

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

Looks good.

@danipen danipen merged commit d091742 into AvaloniaUI:master Jul 19, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants