Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Tab key should enter the selected suggestion #6971

Closed
hipwelljo opened this issue Feb 22, 2014 · 11 comments
Closed

Tab key should enter the selected suggestion #6971

hipwelljo opened this issue Feb 22, 2014 · 11 comments
Assignees

Comments

@hipwelljo
Copy link

If you begin to type in a CSS property, a popup will present the available properties that start with those letters, selecting the top one by default. If you hit return, it'll enter that highlighted suggestion for you. But if instead you hit tab (like one would be used to when using other IDEs), it will actually add space instead of entering the suggested property for you. Tab and return should do the same thing - auto-fill in the highlighted option.

Before:
before
After:
after

sprint 36

@marcelgerber
Copy link
Contributor

We could maybe make _insertHintOnTabDefault a preference, can't we?

@hipwelljo
Copy link
Author

Why a preference as opposed to just making that change for everyone? In what case would you ever want it to actually add space and present that different popup?

@TomMalbran
Copy link
Contributor

It would be a preference because not everyone wants to insert with Tab. It started as being possible to insert with Tab and Enter, then Tab was removed (#4916), and then functions were possible to make it configurable via an extension (#5084). The only thing missing would be a preference in Brackets (https://trello.com/c/HJdgd6DF/802-common-settings-as-preferences).

@hipwelljo
Copy link
Author

Why wouldn't you want to insert with tab, and instead get whitespace and a different popup? I don't see why that'd be desirable at all.

@TomMalbran
Copy link
Contributor

Here are a few reasons: #4904, #4660. I think the second one is good enought reason to make this configurable and disabled by default.

@TomMalbran
Copy link
Contributor

BTW, there is an extension if you want to change it right now. But it should also be a preference in Brackets.

@hipwelljo
Copy link
Author

That's understandable for extensions which use the tab key for their custom behavior such as code completion, so it should be configurable by the extension. I suppose a user preference is fine for those that find themselves triggering it accidentally, but why do you think tab should add space instead of committing the selected option by default?

Yes I'd be interested to know which extension changes that. :) I'm so used to tabbing in Xcode that it's very trusting to not have that ability in Brackets. Always constantly undoing and redoing it being sure to hit return instead. One of the most annoying things that I've found. ;)

@TomMalbran
Copy link
Contributor

Is a matter of how people use it. Some use Enter, others want to use Tab. So if you don't use Tab and want to add a space and not use any of the code suggestions, you don't want to first close them and then use Tab, you just want to use Tab. So it needs to be a preference. Now the matter if it should be enabled by default or not, might be another issue, and might even only depend on how many people want it one way or the other.

@hipwelljo
Copy link
Author

I imagine most IDEs have it set up such that both tab and return fill in the suggestion. Xcode does but there is a difference. Tab will only complete one word at a time while return will complete the entire suggestion. So if you type "stringw" it'll suggest "stringWithFormat..." and at that point hitting tab would type in "stringWith" and update the suggestions based on that text, but if instead you hit return then it fills in the entire "stringWithFormat..." That allows control when you have names that start with the same text so you don't have to keep typing to filter the list, just tab through it. Not sure how useful that would be outside of the Objective-C language though. Anyways, I believe with Sublime Text as well, tab and return "just works."

@dangoor
Copy link
Contributor

dangoor commented Feb 24, 2014

Reviewed low priority to @TomMalbran who has a pull request #6984 to support this.

@TomMalbran
Copy link
Contributor

This is now fixed with PR #6984. Open the preferences file and add: "insertHintOnTab": true to enable it.

Closing

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants