- Notifications
You must be signed in to change notification settings - Fork33.8k
Update indentation for PHP, JS, and TS#251465
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Merged
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Addressesmicrosoft#136592- For PHP, auto-indent after `if`, `elseif`, `else if`, `while`, `for` and `foreach`. This also fixes an issue where hitting Enter on a blank line below a single line `if` (or other) results in an extra tab.- For PHP, extra dot after `*/` and blank line.- For JS/TS, auto-indent for `else` to be consistent with handling of `if` statements
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Hi@ssigwart thank you for the PR! I will have a look! |
aiday-mar approved these changesJun 17, 2025
benibenj approved these changesJun 17, 2025
7c43b02
intomicrosoft:main 7 checks passed
Uh oh!
There was an error while loading.Please reload this page.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Based on feedback in#136593 (comment).
@aiday-mar, as I mentioned in the linked PR, I wasn't super thrilled with doing it this way based on my thoughts in#43244 (comment) and#43244 (comment). However, I did some testing and VS Code will now unindent when
{
is pressed, which makes the original change to auto-indent still a change in expections, but something I can probably get used to. However, I noticed thatelse
wasn't handle consistently in JS and TS, so I fixed those in here (I see that it was mentioned in#43244 (comment) too). Personally, I can probably remove my extension that reverted the original auto-indentation changes and adjust to the new indentation this PR introduces, but based on feedback from#43244, there might be some backlash when this gets merged.Addresses#136592
if
,elseif
,else if
,while
,for
andforeach
. This also fixes an issue where hitting Enter on a blank line below a single lineif
(or other) results in an extra tab.*/
and blank line.else
to be consistent with handling ofif
statementsTesting
In the following PHP code, hit Enter on the last blank line, it will add a space in front of the new line.
Similarly, if you have the following code and hit Enter on the blank line, it will add a tab in front of the new line.
I also tested writing some
if
,else if
, andelse
statements in PHP, JS, and TS.