You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
'reindent all lines' and formatter have different formatting strategies #19140
But we still have good experience with TypeScript as we allow extensions to customize onEnterRules, the indentation adjusts correctly for most of the case when users press enter.
Right now Reindent lines only read indentation rules and doesn't take onEnter rules into consideration as at least for TypeScript there are a few overlap between the second indentation rules set and onEnterRules.
I suggest to make ReIndent Lines honor onEnterRules and remove unnecessary onEnterRules from TypeScript. cc Matt Bierner (@mjbvz) . Since it's kind of breaking change I'd like to postpone it to following iteration and work together with Matt.
This issue is being closed to keep the number of issues in our inbox on a manageable level, we are closing issues that are not going to be addressed in the foreseeable future: We look at the number of votes the issue has received and the number of duplicate issues filed. More details here. If you disagree and feel that this issue is crucial: We are happy to listen and to reconsider.
Why was this issue closed and points to an issue about switch/case indentation specifically. This is an issue that effects more than just switch. Jsdoc comments are formatted differently by reindent lines vs format, as well as jsx.
I expect all indentation commands to indent the same
There is pretty much zero reason to use Reindent all lines in js/ts files; use format document. Reindent all lines has a lot of bugs and limitations and we do not plan on investing in it further given its complexity. Using Format document is the solution for js/ts files
So, every couple of months I keep coming back to vscode hoping to be able to use it. There is a lot to like with vscode. However, the one thing that keeps getting to me is how indentation works. I stumbled back upon this issue I commented on a couple of months ago.
While I agree Reindent all lines is probably useless in favor of Format document, what I want to do is have reindent current line indent correctly.
Let me explain where I'm coming from on this. I am an avid emacs user, and in emacs the tab key will auto indent the current line. I changed my tab key in my vscode config to execute reindent current line expecting to achieve this behavior, but given the unexpected result, it doesn't work for me. I guess what I really wish is there was a format current line in addition to the already existing format selection and format document
Activity
rebornix commentedon Jan 24, 2017
This is because that our indentation rules for TypeScript is not complete, the one we are using is
The one TextMate or other editors are using is like
But we still have good experience with TypeScript as we allow extensions to customize
onEnterRules, the indentation adjusts correctly for most of the case when users press enter.Right now
Reindent linesonly read indentation rules and doesn't take onEnter rules into consideration as at least for TypeScript there are a few overlap between the second indentation rules set and onEnterRules.I suggest to make ReIndent Lines honor onEnterRules and remove unnecessary onEnterRules from TypeScript. cc Matt Bierner (@mjbvz) . Since it's kind of breaking change I'd like to postpone it to following iteration and work together with Matt.
Nimzozo commentedon Mar 25, 2017
A
caselabel is not a statement and should not be indented, but aligned with theswitch.wuhkuh commentedon Mar 30, 2019
Other issues have been closed in favor of this one, but this issue has gone stale. Could you give us an update?
mjbvz commentedon Apr 12, 2019
Changing switch/case indentation for the JS/ts formatter is tracked by microsoft/TypeScript#18682
vscodebot commentedon Oct 11, 2019
This issue is being closed to keep the number of issues in our inbox on a manageable level, we are closing issues that are not going to be addressed in the foreseeable future: We look at the number of votes the issue has received and the number of duplicate issues filed. More details here. If you disagree and feel that this issue is crucial: We are happy to listen and to reconsider.
If you wonder what we are up to, please see our roadmap and issue reporting guidelines.
Thanks for your understanding and happy coding!
derek-pavao commentedon Oct 23, 2019
Why was this issue closed and points to an issue about switch/case indentation specifically. This is an issue that effects more than just switch. Jsdoc comments are formatted differently by reindent lines vs format, as well as jsx.
I expect all indentation commands to indent the same
mjbvz commentedon Oct 24, 2019
There is pretty much zero reason to use
Reindent all linesin js/ts files; useformat document.Reindent all lineshas a lot of bugs and limitations and we do not plan on investing in it further given its complexity. UsingFormat documentis the solution for js/ts filesderek-pavao commentedon Mar 20, 2020
So, every couple of months I keep coming back to vscode hoping to be able to use it. There is a lot to like with vscode. However, the one thing that keeps getting to me is how indentation works. I stumbled back upon this issue I commented on a couple of months ago.
While I agree
Reindent all linesis probably useless in favor ofFormat document, what I want to do is havereindent current lineindent correctly.Let me explain where I'm coming from on this. I am an avid emacs user, and in emacs the tab key will auto indent the current line. I changed my tab key in my vscode config to execute
reindent current lineexpecting to achieve this behavior, but given the unexpected result, it doesn't work for me. I guess what I really wish is there was aformat current linein addition to the already existingformat selectionandformat documentderek-pavao commentedon Mar 20, 2020
my fault, it looks like
reindent current linecomes from an extension. I appologize