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

Restrict key binding context to reduce Tab key conflict #1015

Closed
OldStarchy opened this issue Sep 24, 2021 · 13 comments · Fixed by #1075
Closed

Restrict key binding context to reduce Tab key conflict #1015

OldStarchy opened this issue Sep 24, 2021 · 13 comments · Fixed by #1075
Labels
Area: Input Related to editor input processing (key presses, key bindings). Help wanted Looking for help. Upstream Pertaining to an upstream component, or blocked by an upstream issue.

Comments

@OldStarchy
Copy link

OldStarchy commented Sep 24, 2021

Proposal

Currently, both this extension and Markdown Table have keybindings for tab. The behaviour of each is not incompatible, but the keybinding for this extension is suppressing the one from Markdown Table.

The tab keybinding provided by the other extension allows easier navigation through tables, and should not conflict with the indentation helper provided by this extension. Is it possible to allow both keybindings to run, or is there a way to fallback to the Markdown Table's markdowntable.nextCell command if this extension's tab key would otherwise have no effect?

References

An issue has already been raised takumisoft68/vscode-markdown-table#18

@Lemmingh Lemmingh added Area: Input Related to editor input processing (key presses, key bindings). Upstream Pertaining to an upstream component, or blocked by an upstream issue. labels Sep 24, 2021
@Lemmingh Lemmingh self-assigned this Sep 24, 2021
@Lemmingh
Copy link
Collaborator

fallback

Not possible for now.

VS Code sorts key bindings and dynamically chooses only one to dispatch.

If there were a fallback or hook mechanism, we probably wouldn't have to write so many ugly when clauses.

See:

@OldStarchy
Copy link
Author

It looks like writing custom when clauses is the intended way to deal with this.

@Lemmingh
Copy link
Collaborator

We've known it from dealing with VSCodeVim (a Vim emulator).

But a critical problem is race condition. As far as I'm aware, there will be a higher (seemingly medium) risk of mismatch between prediction and reality, if we don't intercept input to do analysis.

@Lemmingh Lemmingh added the Help wanted Looking for help. label Oct 18, 2021
@Lemmingh Lemmingh changed the title Compatibility with takumii.markdowntable Restrict key binding context to reduce Tab key conflict Oct 23, 2021
@Lemmingh Lemmingh removed their assignment Oct 23, 2021
@veonua
Copy link

veonua commented Nov 8, 2021

The extension hijacks tab so other extensions that use the tab to accept auto-complete/auto-correct would not run.

It is very annoying to see a completed/corrected version of a word or phrase but clicking tab just inserts spaces in a word.

@Lemmingh
Copy link
Collaborator

Lemmingh commented Nov 8, 2021

use the tab to accept auto-complete/auto-correct

Do you mean "Inline Suggestion"?
#1011

@veonua
Copy link

veonua commented Nov 8, 2021

yes, including CoPilot. But there are many spelling extensions and a tab is a popular keystroke to accept suggestions.

@Lemmingh
Copy link
Collaborator

Lemmingh commented Nov 8, 2021

many spelling extensions

May I know which ones?

You can also follow VS Code's guide to trace the key binding resolution.


I'm a bit confused here. "Inline Suggestion" is still a proposed feature. VS Code and its partners can ship extensions that invoke proposed APIs, whilst others may call them only during debug.

@imthenachoman
Copy link

What exactly do these two do?

  • markdown.extension.onTabKey
  • markdown.extension.onShiftTabKey

Removing the keybinding for them fixes the issue but I'm unsure what that breaks with Markdown All in One.

I want to update it's default when condition so that Markdown Table's tab still works in tables.

@yzhang-gh
Copy link
Owner

They are used when you want to indent/outdent a list item. You can see it in the second GIF here https://github.com/yzhang-gh/vscode-markdown#list-editing

@imthenachoman
Copy link

Is there some when condition we can use to check if we are in a list? That way the tab will work for both extensions.

@yzhang-gh
Copy link
Owner

Currently we cannot. There is an ongoing PR #1075 dealing with it. Not sure when it will be released, but we will give you an update when it happens.

@imthenachoman
Copy link

Rock on. Thanks!

@yzhang-gh
Copy link
Owner

It has been available in the pre-release version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Input Related to editor input processing (key presses, key bindings). Help wanted Looking for help. Upstream Pertaining to an upstream component, or blocked by an upstream issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants