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

IDE: Intellisense - Press Tab to get out of closing quote/bracket #49172

Closed
RandomEngy opened this issue Nov 4, 2020 · 5 comments
Closed

IDE: Intellisense - Press Tab to get out of closing quote/bracket #49172

RandomEngy opened this issue Nov 4, 2020 · 5 comments

Comments

@RandomEngy
Copy link

RandomEngy commented Nov 4, 2020

Brief description:

I'd like to be able to press Tab to get out of closing ", ), ] and }. This is faster than moving my hands off of home row to hit the arrow keys, or hitting Shift+", Shift+), Shift+], or Shift+] depending on which character I need to type over.

If I need to get past a few of them, it's easy to just hit Tab a few times. And I've never needed to actually insert a Tab in any of these cases.

Resharper just implemented this feature, but a few years too late as I am no longer using it.

Languages applicable:

C#

Example:

If the cursor is |:
var array = new SomeClass[this.SomeFunction(new SomeOther("text|"))];

Pressing Tab once would move the cursor outside the closing ". Pressing again would move it outside the first ). Pressing it again would move it outside the second ). Pressing again would move outside the ].

@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Nov 4, 2020
@sharwell
Copy link
Member

sharwell commented Nov 4, 2020

The IDE already supports Tab today for type-over in the scenarios listed above, but it's a rarely used feature that doesn't seem to provide significant value over other features that can make better use of the Tab key. Does it work to just type ; or Shift+Enter? If not, can you provide some examples for specific cases that would be beneficial for you?

@sharwell sharwell added Feature Request and removed untriaged Issues and PRs which have not yet been triaged by a lead labels Nov 4, 2020
@RandomEngy
Copy link
Author

This is not about autocomplete. It's about moving the cursor. If you take a look at my example, you have the cursor at the end of a string, where there is no sensible autocomplete action to fire. If I press Tab there, it just inserts a tab into the editor. I would rather it move the cursor past one character to the right. If I press ; it inserts a ; into the string. If I press Shift+Enter it makes a newline and moves the cursor there.

The example I posted in my original post shows where it would be beneficial.

@sharwell
Copy link
Member

sharwell commented Nov 5, 2020

If I type exactly the following:

_ = ToString(ToString("

Followed by Tab, Tab, Tab, I get the following code, with the caret position marked by $$:

_ = ToString(ToString(""))$$

If I press ; it inserts a ; into the string.

This would be expected. Semicolon handling works inside of parentheses and brackets, but doesn't override the behavior inside of strings where a user might want to type a literal ;.

The example I posted in my original post shows where it would be beneficial.

For this example, it appears that Shift+Enter is strictly better than the suggested behavior for Tab (rather than hitting several Tab plus Enter, you only have to hit one thing). If this was not the intent, can you clarify?

@sharwell
Copy link
Member

sharwell commented Nov 5, 2020

⚠️ Note that the use of Tab in this context is incompatible with proposal #12363 (comment) which is currently under active development. While a Visual Studio extension could implement full support for Tab in the above cases (even when not inside a brace matching session), users with that extension would have limited ability to use the upcoming features.

The primary recommendation for moving from inside a matching construct to outside it is one of existing features (Complete Statement with ;, or Smart Break Line with Shift+Enter).

@RandomEngy
Copy link
Author

Apologies! I didn't realize this had already been done. I had just tested by clicking to put the cursor there and pressing Tab. If I've been typing, it does indeed work.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants