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

Accept suggestions on mobile #7

Closed
hatemhosny opened this issue Mar 26, 2024 · 7 comments
Closed

Accept suggestions on mobile #7

hatemhosny opened this issue Mar 26, 2024 · 7 comments

Comments

@hatemhosny
Copy link

hatemhosny commented Mar 26, 2024

Great project 👍
Thank you for open-sourcing this.

CodeMirror6 has great mobile support. I use it in LiveCodes (a client-side code playground for 80+ languages/frameworks) as the default editor on mobile.

Currently accepting suggestions requires hitting the tab button which is not available by default on mobile keyboards.
Would you consider adding additional key binding for accepting suggestions? May be "Enter" key.

@tmcw
Copy link
Member

tmcw commented Mar 26, 2024

Yeah, good point - there should be a solution to this. Enter seems reasonable, but I'm not sure about adding Enter as a shortcut on desktop - it feels like there are situations where you're at

// Write a factorial function<cursor>

Where you want to hit Enter, but not accept a suggestion below.

@stevekrouse
Copy link

I would expect that clicking on the suggestion would accept it on mobile

@tmcw
Copy link
Member

tmcw commented Mar 26, 2024

Yeah - that'll be somewhat harder to implement with the strategy in this plugin, but it's an option.

@hatemhosny
Copy link
Author

hatemhosny commented Mar 26, 2024

Yeah, good point - there should be a solution to this. Enter seems reasonable, but I'm not sure about adding Enter as a shortcut on desktop - it feels like there are situations where you're at

// Write a factorial function<cursor>

Where you want to hit Enter, but not accept a suggestion below.

I agree. On desktop we should stick to "tab" and not "Enter".

The other question is how to reject suggestions without "Esc" button.
May be continue typing (not ideal) or click outside (as opposed to click on suggestion to accept). But then what happens to the cursor position?

@hatemhosny
Copy link
Author

Another suggestion for rejecting suggestions on mobile is timing out.
e.g. if a suggestion was not accepted for e.g. 2 seconds, then it would disappear.
Again, this behavior would only be on mobile.

@hatemhosny
Copy link
Author

I would expect that clicking on the suggestion would accept it on mobile

Clicking on the suggestion now works very well (#12).
Also clicking outside (with the mouse) rejects suggestions.
Thank you.

However, I'm having trouble rejecting suggestions on touch screens.
When I touch outside suggestion it is still accepted. The only way I can reject suggestion now is continue typing (sometimes this even doesn't reject and continue displacing the suggested text).
I have tried that on android phone and windows with touch screen.

Great work indeed.
I just thought it would be useful to report that.

@stevekrouse
Copy link

Closing this ticket because suggestions are now accepted on mobile.

The problem now is that they are always suggested, as @hatemhosny points out. New ticket for rejecting suggestions on mobile if the user clicks on any code except for the ghost text: #43

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

No branches or pull requests

3 participants