-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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
Options for automatic indentation #19303
Comments
"good option", more like "must have". This is driving me crazy. |
Oh no! Looks frustrating - sorry about that! @rebornix and @alexandrudima to the rescue! |
Fixed via b1c8dad |
wait a second. Did you add a fix for the concrete issues or did you allow us to disable it completely? Because I think we really need the second one. |
That fix targets a different issue similar in nature, and the fix is that typing a closing bracket will not change the current line's indentation if the bracket is preceded by any non-whitespace characters, covering both issues exemplified in the two gifs in this thread. Tomorrow's insiders build will contain the change and it would be great if you could try it out and provide additional feedback. We can then proceed to reopen this issue or start a new one, as you prefer. |
@alexandrudima I really think having the ability to turn the auto-format off is important. Not everyone wants it. |
it makes many assumptions about regularity and syntax in languages. Bad if
your language has different options.
Am 25.01.2017 9:45 nachm. schrieb "Isaac Abraham" <[email protected]
…:
@alexandrudima <https://github.com/alexandrudima> I really think having
the ability to turn the auto-format off is important. Not everyone wants it.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#19303 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AADgNBpqjs3Pj2GsLAJFgimDtYj12Zn3ks5rV7RegaJpZM4Ls7fn>
.
|
@forki are you using the Stable version? The one you just mentioned is fixed in Insider. I can see why you want to have the option to turn off this feature. Right now when there is an indentation adjustment, it's triggered by one of the following:
The first two were implemented first to provide a reasonable experience with brackets and later we introduced Indentation Rules as other editors do. Indentation rules are not silver bullet, they can't make the indentation perfect as they are just talking about limited number of lines around. Our target is not making indentation rules perfect as that's not possible but we want to make it reasonable. For users who want to make the indentation correct always, a proper formatter which reads AST can actually help, for example This iteration we enhanced Format with For anyone who is interested in this area, you may want to take a look at #17868 and PRz are always welcome. |
Yes I'm on the released bits. Regarding indentation: just moving everything 4 (or 2 depending on project) chars to the right on tab would be the 100% correct solution for us. No need for ast or any other heuristic. |
@forki @isaacabraham @Krzysztof-Cieslak Can you please try out the latest insider that went out a few hours ago? And provide concrete examples of what is not working as expected. Thank you! |
I can confirm that some of the other cases that I see on the mainline build are fixed on the insider build. But I still think you should allow people to turn this off - people might use a formatting style you don't cater for, or simply not want it at all. |
Let me know if this is unrelated, but I see a similar issue with Python as I reported in https://github.com/DonJayamanne/pythonVSCode/issues/666 Edit: Just realized this was already referenced by OP. |
I also noticed that vscode sometimes is inserting braces we I press space.
Urgs
Am 27.01.2017 2:13 nachm. schrieb "Siddhartha Gandhi" <
[email protected]>:
… Let me know if this is unrelated, but I see a similar issue with Python as
I reported in DonJayamanne/pythonVSCode#666
<https://github.com/DonJayamanne/pythonVSCode/issues/666>
[image: image]
<https://cloud.githubusercontent.com/assets/21064086/22371973/5e7dddc0-e468-11e6-802a-0957c128d42c.png>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#19303 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AADgNDpgXRRQldc2FmYpcD3CADdBUNhjks5rWe1ugaJpZM4Ls7fn>
.
|
I tested this on the latest insider, and it appeared to be fixed. Although my question would be now, is when you have an open bracket expression that has yet to be closed, and you press enter, why the default behavior is not to indent to the parenthesis location. |
I definitely want to be able to disable any automatic indentation completely. As it is now, if I'm at the end of a line Tested in both the latest Insiders build and 1.12.2. |
|
Automatic indentation currently coming out of the box with VSCode is really unhelpful in any white-space significant programming language.
Twitter discussion (F#): https://twitter.com/isaac_abraham/status/824035064807731201
Problem reported in Python plugin: https://github.com/DonJayamanne/pythonVSCode/issues/666
Example behavior in F# (notice how new errors are shown after this automatic formatting):
As far as I understand this behavior can be controlled using
IndentationRules
inLanguageConfiguration
but:I think it would be good to add option to disable this behavior.
The text was updated successfully, but these errors were encountered: