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

Maybe adjust behavior of useTabOnHangingIndent? #103

Open
jkyeung opened this issue Sep 13, 2022 · 1 comment
Open

Maybe adjust behavior of useTabOnHangingIndent? #103

jkyeung opened this issue Sep 13, 2022 · 1 comment

Comments

@jkyeung
Copy link

jkyeung commented Sep 13, 2022

This is more of a question or comment than a feature request or bug report: What's the rationale for putting the cursor just before the closing bracket rather than just after, upon pressing Tab?

If I've got

foo = (|)

and press Enter to get

foo = (
    |
)

and then type some elements, like

foo = (
    'spam',
    'ham',|
)

I would think that I am trying to get to

foo = (
    'spam',
    'ham',
)|

or perhaps even

foo = (
    'spam',
    'ham',
)
|

as simply and easily as possible, but Tab actually gets me to

foo = (
    'spam',
    'ham',
|)

which is probably very rarely what I want. And by that time, the closing bracket is no longer considered "automatically inserted" by VS Code, and is thus not subject to the default typeover. (Setting "editor.autoClosingOvertype": "always" could help, but some people can't stomach that option.)

I've been playing around with this a little bit, because it's close to allowing me to feel OK about letting VS Code autoclose brackets for me, but not quite there. And clearly most people don't seem to have any problem with the current VS Code behavior, with or without useTabOnHangingIndent.

@kbrose
Copy link
Owner

kbrose commented Oct 3, 2022

Not impossible to do, but it is more than a simple code change because we aren't inserting the ending bracket, we're just using textEditor.insertSnippet() to insert the newline and indentation, which restricts where we can put the cursor.

A possible work around would be to delete the bracket that exists, and insert our own, adding a $n (for some n) pointer after the bracket.

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

No branches or pull requests

2 participants