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

Configure selector keys for suggest widget #3658

Closed
csholmq opened this issue Mar 3, 2016 · 13 comments
Closed

Configure selector keys for suggest widget #3658

csholmq opened this issue Mar 3, 2016 · 13 comments
Assignees
Labels
*duplicate Issue identified as a duplicate of another issue(s) feature-request Request for new features or functionality ux User experience issues

Comments

@csholmq
Copy link

csholmq commented Mar 3, 2016

Whenever suggest widget (e.g. a completion list) is summoned (by a configured trigger character, e.g. . or >), both Tab and Enter are valid for selection by default. More than once I've accidentally accepted the suggestion rather than doing a line break as intended.

mitaki28/vscode-clang#8 is a good example of this where a completionProvider is configured and triggered by >, causing issues when trying to do a line break:

At first I thought I'd suggest that the default should be only Tab to avoid all of this. But then I came to think that perhaps more ideally this should be configurable by the extension that registers a provider with triggerCharacters. What do you think?

@isidorn isidorn added the feature-request Request for new features or functionality label Mar 3, 2016
@joaomoreno
Copy link
Member

It's already part of the registerCompetionItemProvider signature.

@csholmq
Copy link
Author

csholmq commented Mar 3, 2016

@joaomoreno Could you elaborate? Can't find anything on this.

Just so we're talking about the same thing. Yes, triggerCharacters are in the signature. But the issue is about

When a completionItemProvider is called upon and a suggestion widget is presented, which keys (default Tab and Enter) are allowed as confirmation of a suggestion. Would be preferable to disable Enter as this can interfere.

@joaomoreno
Copy link
Member

Oh! Apologies, I confused the two features!

@joaomoreno joaomoreno reopened this Mar 3, 2016
@joaomoreno joaomoreno removed their assignment Mar 3, 2016
@joaomoreno
Copy link
Member

Removing Enter from the acceptance keys would make the whole interaction rather strange, though. I'm not sure that would be such a good idea.

You'd type person-> get it triggered and you wouldn't be able to use Enter?

There are other possibilities here:

  • delay the popup of the Intellisense box when automatically triggered
  • disable > as a trigger character; not a nice solution as well
  • improve the suggestion results to not return anything in some cases; not a nice solution either

@csholmq
Copy link
Author

csholmq commented Mar 3, 2016

I agree that the convention of Enter might not be so popular to remove.

template <typename Type>
Type max(Type a, Type b) {
    return a > b ? a : b;
}

is perhaps a more valid example for e.g. C++. Other languages have for sure syntaxes which could collide with completion trigger characters. It depends on the coding style of the programmer in this instance. It might also come in play when you do an anonymous function calls (lambda abstraction):

context.subscriptions.push(vscode.workspace.onDidSaveTextDocument(d => 
    ...
    yourMagicCode();
    ...
));
  • Delay is dubious since one will suspect that no completions are available if it's set to more than a second.
  • Disable the offender is a ugly workaround IMO. It removes functionality.
  • Agreed. Sounds complicated as it's no longer language agnostic.

That is why I'm suggesting that each provider with trigger characters should be able to override the default mapped keys for acceptQuickFixSuggestion.

@joaomoreno joaomoreno added the ux User experience issues label Mar 3, 2016
@joaomoreno
Copy link
Member

So a C++ user could never use the Enter key to accept a suggestion? I'm not sure that is OK.

I do recognise the problem though.

@stevencl any thoughts?

@csholmq
Copy link
Author

csholmq commented Mar 3, 2016

A C++ could very well be able to use this. I'm just suggesting that this choice is left for the extension to control and ultimately by the end user which configures the extension. It all depends on the preferences of the user base. As it stands now, the "only" solution is to disable Enter as a shortcut for all extensions and languages.

@stevencl
Copy link
Member

stevencl commented Mar 5, 2016

Is it possible to trigger on a string, or sequence of characters? So instead of triggering on '>' we would trigger on '->' for C++?

@csholmq
Copy link
Author

csholmq commented Mar 5, 2016

@stevencl That's actually a nice workaround. At least for languages with -> as member operators.

@joaomoreno
Copy link
Member

ping @jrieken

@jrieken
Copy link
Member

jrieken commented Mar 8, 2016

Currently there is no way to configure a trigger sequence but only single characters. Still, the issue would continue to exist as most people run with 24x7 IntelliSense enabled. I tend to favour an option that configures if enter should accept a suggestion or not - for simplicity and ease of learning independent of the language.

@jrieken
Copy link
Member

jrieken commented Mar 8, 2016

see #1657 for more on this

@jrieken
Copy link
Member

jrieken commented Mar 9, 2016

closing this as a duplicate of #1657 as we will go down the path of configuring what Enter does

@jrieken jrieken closed this as completed Mar 9, 2016
@jrieken jrieken added *duplicate Issue identified as a duplicate of another issue(s) and removed *duplicate Issue identified as a duplicate of another issue(s) labels Apr 29, 2016
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*duplicate Issue identified as a duplicate of another issue(s) feature-request Request for new features or functionality ux User experience issues
Projects
None yet
Development

No branches or pull requests

5 participants