unicode-math-vscode icon indicating copy to clipboard operation
unicode-math-vscode copied to clipboard

dead keys that use space to expand not working

Open lindem opened this issue 5 years ago • 3 comments

If I enable this extension, I can no longer input single quotes.

The single quote ' is a dead key on my keyboard, so I press ' and Space to insert a pair of them. Unfortunately, this is also the type of quote I mostly use (I work with SQL a lot).

When I disable this extension, it works normal again.

lindem avatar Sep 28 '19 16:09 lindem

After looking at the code briefly, I think that the problem is that space expands a symbol and space is supposed to insert the character for the dead key.

Somewhere "in between" this extension catches space, inspects the surrounding area, finds that there is no special sequence to expand, and returns "space" instead of the combined character.

In vscode, there is no options page for this extension. Probably an option to disable expanding symbols with space would help, but maybe it is overkill for just one user complaining about it.

Otherwise, I do not have a good idea what to do about that behaviour (also, I have never written a vscode extension).

lindem avatar Sep 28 '19 16:09 lindem

After further studying the documentation of the extension API, the best I could come up with (works for me though) is to completely remove the default keybinding of the extension by adding this to my keybindings.json:

{
  "command": "-unicode-math-vscode.commit_space",
  "key": "space",
  "when": "editorTextFocus && !editorTabMovesFocus && !inSnippetMode && !hasSnippetCompletions && !editorTabMovesFocus && !editorReadonly"
}

(note the minus sign in the "command").

Expanding the symbols with tab is sufficient for me.

It seems that it is very difficult, if not impossible, to make vscode aware of dead keys. I am not even sure how to phrase an issue on the vscode issue tracker, because I cannot tell if it is a bug or intended behaviour.

lindem avatar Sep 28 '19 18:09 lindem

Hi. Same problem here, and a similar workaround inspired by @lindem. Open "Keyboard Shortcuts" in VS Code, select "unicode-math-vscode.commit_space" and bind it to the <Tab> key.

rbejar avatar Jan 10 '20 12:01 rbejar