mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-20 02:08:47 +00:00
Update indentation for PHP, JS, and TS (#251465)
* Update indentation for PHP, JS, and TS. Addresses https://github.com/microsoft/vscode/issues/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 * polish --------- Co-authored-by: Aiday Marlen Kyzy <amarlenkyzy@microsoft.com>
This commit is contained in:
@@ -121,7 +121,7 @@
|
||||
"pattern": "^(\\t|[ ])*[ ]\\*[^/]*\\*/\\s*$|^(\\t|[ ])*[ ]\\*/\\s*$|^(\\t|[ ])*[ ]\\*([ ]([^\\*]|\\*(?!/))*)?$"
|
||||
},
|
||||
"indentNextLinePattern": {
|
||||
"pattern": "^((.*=>\\s*)|((.*[^\\w]+|\\s*)(if|while|for)\\s*\\(.*\\)\\s*))$"
|
||||
"pattern": "^((.*=>\\s*)|((.*[^\\w]+|\\s*)((if|while|for)\\s*\\(.*\\)\\s*|else\\s*)))$"
|
||||
}
|
||||
},
|
||||
"onEnterRules": [
|
||||
|
||||
@@ -94,7 +94,14 @@
|
||||
],
|
||||
"indentationRules": {
|
||||
"increaseIndentPattern": "({(?!.*}).*|\\(|\\[|((else(\\s)?)?if|else|for(each)?|while|switch|case).*:)\\s*((/[/*].*|)?$|\\?>)",
|
||||
"decreaseIndentPattern": "^(.*\\*\\/)?\\s*((\\})|(\\)+[;,])|(\\]\\)*[;,])|\\b(else:)|\\b((end(if|for(each)?|while|switch));))"
|
||||
"decreaseIndentPattern": "^(.*\\*\\/)?\\s*((\\})|(\\)+[;,])|(\\]\\)*[;,])|\\b(else:)|\\b((end(if|for(each)?|while|switch));))",
|
||||
// e.g. * ...| or */| or *-----*/|
|
||||
"unIndentedLinePattern": {
|
||||
"pattern": "^(\\t|[ ])*[ ]\\*[^/]*\\*/\\s*$|^(\\t|[ ])*[ ]\\*/\\s*$|^(\\t|[ ])*\\*([ ]([^\\*]|\\*(?!/))*)?$"
|
||||
},
|
||||
"indentNextLinePattern": {
|
||||
"pattern": "^\\s*(((if|else ?if|while|for|foreach)\\s*\\(.*\\)\\s*)|else\\s*)$"
|
||||
}
|
||||
},
|
||||
"folding": {
|
||||
"markers": {
|
||||
|
||||
@@ -139,7 +139,7 @@
|
||||
"pattern": "^(\\t|[ ])*[ ]\\*[^/]*\\*/\\s*$|^(\\t|[ ])*[ ]\\*/\\s*$|^(\\t|[ ])*\\*([ ]([^\\*]|\\*(?!/))*)?$"
|
||||
},
|
||||
"indentNextLinePattern": {
|
||||
"pattern": "^((.*=>\\s*)|((.*[^\\w]+|\\s*)(if|while|for)\\s*\\(.*\\)\\s*))$"
|
||||
"pattern": "^((.*=>\\s*)|((.*[^\\w]+|\\s*)((if|while|for)\\s*\\(.*\\)\\s*|else\\s*)))$"
|
||||
}
|
||||
},
|
||||
"onEnterRules": [
|
||||
|
||||
Reference in New Issue
Block a user