-
Notifications
You must be signed in to change notification settings - Fork 28
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
PHP8.1 Formatting Issue #151
Comments
Hi @m2cc , I'm on this. Related to driade/phpfmt8#62 |
thank you. |
Hi @m2cc . Let's see if the lastest release fixes this. Thanks! |
yes, you fixed this, thank you!! but when the array keys is chinese,it not works。 the code : $arr = [
'键一' => 4, // 1
'键2' => 11, // xxxx
'键三' => 12, // xxxx
'其它长键' => 6445, // xxxx
'absc' => 6445, // xxxx
]; after format, it becomes like this: $arr = [
'键一' => 4, // 1
'键2' => 11, // xxxx
'键三' => 12, // xxxx
'其它长键' => 6445, // xxxx
'absc' => 6445, // xxxx
]; expected: align comments and align keys。 My current configuration is as follows: "phpfmt.passes": [
"AlignEquals",
"AlignSuperEquals",
"AlignPHPCode",
"AlignDoubleArrow",
"AlignGroupDoubleArrow",
"AlignComments",
"AutoSemicolon",
"ClassToStatic",
"MergeElseIf",
"OrderAndRemoveUseClauses",
"PrettyPrintDocBlocks",
"PSR2EmptyFunction",
"ReindentAndAlignObjOps",
"ReindentSwitchBlocks",
"ReindentEnumBlocks",
"RemoveIncludeParentheses",
"RemoveSemicolonAfterCurly",
"ShortArray",
"SmartLnAfterCurlyOpen",
"SortUseNameSpace",
"SpaceBetweenMethods",
"TrimSpaceBeforeSemicolon",
"WrongConstructorName",
], |
Hi @m2cc I've been checking this and I think that the problem is mixing chinese characters with standard ones. The "space" we use to fill the lines comes from standard " ". But chinese characters are wider than the standard (monospaced) ones, so when we fill the lines with spaces, arrows get visually misaligned. Please check the screenshot where you may see it. I've read overthere that people have similar problems If chinese characters would be rendered as 2 wide standard chars we could make the calculations to perfectly align the code. |
Subject: Issue with PHP Formatting in PHP8.1, the plugin version is 1.2.12
我目前的配置如下:
before:
after format, it becomes like this:
exexpected: align comments and alian keys
The text was updated successfully, but these errors were encountered: