Skip to content
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

Equal Sign being pushed. #165

Open
wlmelo opened this issue Jan 15, 2025 · 7 comments
Open

Equal Sign being pushed. #165

wlmelo opened this issue Jan 15, 2025 · 7 comments

Comments

@wlmelo
Copy link

wlmelo commented Jan 15, 2025

When formatting the code, the equal sign is being pushed. Is there any configuration to fix this?

Example:

Before:

$abc = 1;
$abcdefg = 1;
$i = 0;

After:

$abc             = 1;
$abcdefg         = 1;
$i               = 0;

I want it to stay the same as it was before. Is that possible?

@driade
Copy link

driade commented Jan 15, 2025

Hi @wlmelo could you please share your configuration?

@driade
Copy link

driade commented Jan 15, 2025

@kokororin could this be related with the new default configurarion for the extension? Would that configuracltion be applied only to new installations or to upgrades too?

@wlmelo
Copy link
Author

wlmelo commented Jan 15, 2025

I solved it by uninstalling and reinstalling it. But this time, I clicked to install the previous version.

It's back to normal now. Thank you for your attention.

@kokororin
Copy link
Owner

@driade The default configuration of a VSCode extension will take effect when the user has not explicitly set any configuration. For example, if no passes are configured by the user, the passes value from the default configuration will apply. This behavior is independent of whether the extension was installed fresh or updated; as long as the user has not overridden the settings, the default configuration will be used.

@cyaoz94
Copy link

cyaoz94 commented Jan 16, 2025

@kokororin seems like double arrow and equal signs are being aligned even without setting "phpfmt.enable_auto_align" to true.

I've tried explicitly setting it to false but the problem remains.

@kokororin
Copy link
Owner

@cyaoz94 Could you please provide the command line output? You can view it by pressing F1 and selecting phpfmt: Open output.

@cyaoz94
Copy link

cyaoz94 commented Jan 17, 2025

Output is as follows:

1/17/2025, 9:56:11 AM [INFO] Executing command: php "/Users/casper/.vscode/extensions/kokororin.vscode-phpfmt-1.2.12/dist/fmt.stub.php" --psr2 --indent_with_space=4 --passes=AlignDoubleArrow,AlignPHPCode,SpaceAfterExclamationMark,AlignConstVisibilityEquals,AutoSemicolon,ConvertOpenTagWithEcho,AlignEquals,MergeNamespaceWithOpenTag,RemoveSemicolonAfterCurly,RestoreComments,ShortArray,ExtraCommaInArray,AlignDoubleSlashComments "/var/folders/0n/_m202lx16rz3pqgdkrypcy0r0000gn/T/temp-jefdkrsfc-RegisteredUserController.php"

Currently I'm explicitly defining phpfmt.passes to remove AlignDoubleArrow, AlignConstVisibilityEquals and AlignEquals transformations.

// phpfmt.passes
  "phpfmt.passes": [
    "AlignPHPCode",
    "SpaceAfterExclamationMark",
    "AutoSemicolon",
    "ConvertOpenTagWithEcho",
    "MergeNamespaceWithOpenTag",
    "RemoveSemicolonAfterCurly",
    "RestoreComments",
    "ShortArray",
    "ExtraCommaInArray",
    "AlignDoubleSlashComments"
  ],

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants