-
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
comments moves to beginning of the line if written above control structure #142
Comments
Hi @vikaskhunteta. I use it on my regular basis on Sublime Text, and seems fine. May you please share some of this big files with me to check if there's any infinite loop? The code behind both vscode-phpfmt and the sublime plugin it's the same (https://github.com/driade/phpfmt8). |
@driade Thanks for prompt response, the files on which the extension hangs into sublime doesn't have even 200 lines, I believe there must be some conflict with other extension installed. Here is the list of extension installed Better Completion, Bootstrap 3 Snippets, BracketHighlighter, Brackets Color Scheme, Color Highlighter, CSS Lint, DocBlockr, DotENV, Emmet, Emmet CSS Snippets, Formatter, Git, HTML, HTML-CSS-JS Prettify, HTML5, HTMLBeautify, jQuery, JSHint, JSHint Gutter, JsPrettier, Minifier, Minify, Monokai Extended, PyV8, Rails, Sass, SCSS, SCSS Compiler, SideBarEnhancements, SideBarGit, SublimeCodeIntel, SublimeLinter, SublimeLinter-csslint, SublimeLinter-phplint, Tailwind CSS Autocomplete, WordPress I removed PHPFMT package because of the issue mentioned earlier, I have two PHP installed, default is PHP7.4 also set Path env, but for PHPFMT I configured PHP8.2 as it was not working at all with PHP7.4 into sublime, however into VS Code it working with PHP7.4 without issue. |
Thanks. I'll check the comment formating issue. |
@driade Any update on this? Also did you get chance to debug the issue on Sublime Text with all packages that I have installed on my system? |
No chance to check it, sorry. |
me too. troubling question |
comments moves to beginning, is there any solution? |
@lutyne The only working solution I found is to use of multi line comments instead of single line comments above the if condition |
@vikaskhunteta multi comments cause another problem, the comments are not only moved to the head, but also separated...... |
Sorry, I'll try to find a solution next month |
|
A matter of habit.... It seems I need to adapt. |
@driade Did you get chance to look into this? Other than issue with comments above if the comment is placed after the closing curly braces like below
then after formatting it would go down like this
sometimes comments after the syntax like this also move to new line below the syntax
|
Hi @vikaskhunteta @lutyne I'm unable to reproduce this issue. For example this code on my side gets perfectly formated <?php
class A
{
// foo
public $a = 1;
// bar
public $b = 2;
public function handle()
{
// $seach_param['b'] = input();
// $seach_param['b'] = input();
// $seach_param['b'] = input();
} // comment
} May you please share some complete samples? |
@driade Write down the single line comment above if condition or foreach statement, also put single line comments in each row without new line between them, on format a new line will be put between them see the screenshot |
// comment 1
// comment 2
// comment 3
if ($a) {
} <?php
class A
{
public function handle()
{
// comment 1
// comment 2
// comment 3
if ($a) {
}
}
} This gets correctly formated on my side. It may help if you share a complete failing snippet |
@driade Can you share your extension settings? Btw I am using VS code. |
@vikaskhunteta there you've {
"phpfmt.autocomplete": false,
"phpfmt.autoimport": false,
"phpfmt.excludes": [
"SpaceBetweenMethods"
],
"editor.formatOnSave": true,
"phpfmt.passes": [
"AlignDoubleArrow",
"AlignPHPCode",
"SpaceAfterExclamationMark",
"AlignConstVisibilityEquals",
"AutoSemicolon",
"ConvertOpenTagWithEcho",
"AlignEquals",
"MergeNamespaceWithOpenTag",
"RemoveSemicolonAfterCurly",
"RestoreComments",
"ShortArray",
"ExtraCommaInArray",
"AlignDoubleSlashComments"
],
"phpfmt.php_bin": "/usr/local/bin/php",
"phpfmt.psr1": false,
"phpfmt.psr1_naming": false,
"phpfmt.psr2": true,
"phpfmt.readini": true,
"phpfmt.smart_linebreak_after_curly": false,
"phpfmt.version": 4,
"phpfmt.wp": false
} |
Hi,
Everything works fine except the comments before the control structure, see the screenshot
Other than above issue, the extension works great into VS code even for large files but doesn't work into sublime text, only very small files are formatted. For medium to large size files, it hangs the editor and I have to end the process to resume working. I don't use VS code for development purpose, so I have to switch between editors just for formatting.
The text was updated successfully, but these errors were encountered: