-
Notifications
You must be signed in to change notification settings - Fork 31
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
Monaco commands with overlapping shortcuts get ignored #8
Comments
Line 331 in 34b32db
I think the issue is here. This prevents default and stops poropagation, even though it wasnt doing anything |
If you change the command to return whether or not it actually did something, then you could use that information to figure out if you should preventDefault and stopPropagation. e.g. even though esc is registered doesn't mean I want to stop prop/prevent default. |
You can see this use case in https://editor.bitwiser.in/ -- if you have autocomplete open and press escape, it both closes autocomplete and boots you out of editing mode. |
I think Monaco utilizes commnds to handle keybindings. Not sure if it's being used here, but that might be beneficial for chaining events like this. |
My initial implementation tried to use this but the problem is that vim mode needs to know about all the key presses, even during insert mode, to function properly. And monaco's I'll have to re-think this approach for situations like autocomplete dialog and any other similar ones though. |
I think you can get away with minimal changes without having to swap to commands. Right now the code I linked does the following:
What it needs to do is:
The major change is that each command needs to return either true or false depending on whether or not action was taken. For escape for example, you need to return true if you were in a mode like insert, and you left to get back into normal mode. If you're in normal mode already, escape does nothing so it would return false. |
Since escape is also used for leaving input mode in Vim, this alert appears to never be fired.
It'd be cool if monaco-vim let keyboard shortcuts propogate if they were unhandled, whereas currently it seems that propagation is stopped somewhere.
The text was updated successfully, but these errors were encountered: