onecentlin / laravel-blade-snippets-vscode

Laravel blade snippets and syntax highlight support for Visual Studio Code
MIT License
137 stars 38 forks source link

blade formatter not work #61

Open Obka opened 6 years ago

Obka commented 6 years ago

Hello, I use ALT+SHIFT+F in html file for format my code , now in blade.php when i press this shortcut key nothing happens how can i fix this ?

Thnak you.

onecentlin commented 6 years ago

@Obka Do you add "blade.format.enable": true, to your user settings?

Obka commented 6 years ago

@onecentlin Yes i add in setting . image

onecentlin commented 6 years ago

@Obka Do you save the file as *.blade.php, and it's not just untitled unsaved file.

Obka commented 6 years ago

@onecentlin yes i have an *blade.php and saved the file ...

image

onecentlin commented 6 years ago

@Obka Is there any other blade relative extensions you installed? I cannot reproduce your issue. Also please make sure you are in Laravel Blade language mode.

Obka commented 6 years ago

@onecentlin i'm sure not installed any extensions for laravel or php ! i use Laravel Blade in my editor language . However thank for answer.

onecentlin commented 6 years ago

@Obka Try to install new version just released v1.18.0, and see if it works, thanks.

Obka commented 6 years ago

@onecentlin Thank you so much my problem is solved .

adrianriyadi commented 6 years ago

in version 1.18.0, this extension will add break everytime I run format. which can cause my code to be wasting space.

adrianriyadi commented 6 years ago

@onecentlin

onecentlin commented 6 years ago

@adrianriyadi Sorry for the inconvenient. The auto format for blade is still way too many to improve.

adrianriyadi commented 6 years ago

then we'll very glad if you can improve and fix that soon :+1: @onecentlin

etiennejcharles commented 6 years ago

For anyone coming across this issue, when changing your user settings, don't forget to restart your VSCODE, or else, it simply won't take effect - I don't know if that's another issue though :p

Using Version 1.26.0-insider on MAC.

Thank you @onecentlin for the hard work! I appreciate really!

ghost commented 5 years ago

Désolé mais je vais répondre en français. J’ai résolus ce problème au niveau de files.associations dans la config Il suffit de faire ".blade.php":"blade" au lieu de ".blade.php":"html". En espérant que ça va aider.

n3omaster commented 5 years ago

This worked for me 😉

"blade.format.enable": true,
"files.associations": {
    "*.php": "php"
},
adeariniputri commented 5 years ago

Hello, I use ALT+SHIFT+F in html file for format my code , now in blade.php when i press this shortcut key nothing happens how can i fix this ?

Thnak you.

you should go to setting and enable blade.format

djmtype commented 5 years ago

I've enabled blade format code. "blade.format.enable": true. Then, I restart VS. When I format the document, all of the lines are aligned to the left – no indentation. All of my files end in *.blade.php. I'm using the Sage Wordpress theme.

As @n3omaster n3omaster mentioned above:

"files.associations": {
    "*.php": "php"
},

This does not work for me. The blade document will turn into a regular php document after restarting and lose all blade syntax highlighting and the ability to use Blade snippets.

I do not have any other formatters installed. VS 1.40.0; Laravel Blade Snippets 1.20.0

andremartinsds commented 4 years ago

Are you added the extension in vscode? this is the link for extension exension laravel blade you after add in setting.json

 "emmet.triggerExpansionOnTab": true, // enable tab to expanse emmet tags
    "blade.format.enable": true,         // if you would like to enable blade format
    "emmet.includeLanguages": {
      "blade": "html"
    },

now you restart you vscode, it works for me

Slivicon commented 4 years ago

Same issue as @djmtype - html in blade file gets formatted, but blade directives ("@") are all left-aligned with no indentation when executing format. I suspect there is difficulty for the parser to understand when both html and blade directives need formatting mixed together. blade.format.enable is true in settings, and am not setting file associations .php to php as that removes separate functionality specific to .blade.php files (as was mentioned). Answer from @andremartds did not work for me. Somewhere else someone mentioned perhaps something like this is needed, but for blade: https://github.com/Microsoft/vscode/blob/72ea2ad8673b07d1432cff1f0ec52ca7ec37526c/extensions/html/client/src/htmlMain.ts#L119

alexkerber commented 4 years ago

Any news with this? Still a problem here. I really don't want to use beautify for this.

MaskyS commented 4 years ago

@onecentlin Ping! Could you look into this, or point us in the right direction to try fixing this?

rashmikagayan commented 2 years ago

Change your default formatter to none

billpebert commented 2 years ago

Hello i got the same problem with the formatter i have this in the configuration "bladeFormatter.format.useTabs": true, "blade.format.enable": true, "bladeFormatter.format.sortTailwindcssClasses": true

this is a prompt shown when i pressed CTRL + ALT + F image