vscode
vscode copied to clipboard
Add support for Blade (extension .blade.php) files
Issue:
formatting does not work in "*.blade.php**" files..
Hi @Rux77 . PHP support was recently added with PHP-CS-Fixer.
Does PHP
language work if you change from blade
? See https://code.visualstudio.com/docs/languages/overview#_changing-the-language-for-the-selected-file
If PHP
does work, then TO-DO to add Blade language support:
- [ ] Add VSCode language IDs to Unibeautify language for
Blade
: https://github.com/Unibeautify/unibeautify/blob/5eff024eb1373a259c252aef117a3b8f94b1f063/src/languages.json#L660 - [ ] Add
Blade
language support to PHP-CS-Fixer: https://github.com/Unibeautify/beautifier-php-cs-fixer/blob/master/src/index.ts#L20 - [ ] Update VSCode with latest Unibeautify & Beautifier for PHP-CS-Fixer
@szeck87 we need to think about the process for adding new languages and/or beautifiers. It should NOT be in Unibeautify core or the editor extensions (e.g. VSCode). We need some place which is:
- [ ] central (not Unibeautify core, not editor extension, etc)
- [ ] allow voting (prioritization)
🤔
@Glavin001 To be honest I think they should go in Unibeautify core. Languages have to be implemented there anyways. And we can make use of the issue wizard with templates.
Sounds good. The multiple templates will be great for this. As long as beautifier-specific requests are routed to the beautifier's correct repository. I don't want Unibeautify core to get as crowded as Atom-Beautify has.
@Glavin001
Does PHP language work if you change from blade? See
No, it does not format the html elements.The blade files will contain html elements which will not be formatted in this case ( when I set the language to PHP) . but when I set the language to HTML it does trigger the formatting and works great.
Example of blade file (before formatting):
<html>
<head>
<title>App Name - @yield('title')</title>
</head>
<body>
@section('sidebar') This is the master sidebar.
@endsection
<div class="container">
@yield('content')
</div>
</body>
</html>
Example of blade file (after formatting):
<html>
<head>
<title>App Name - @yield('title')</title>
</head>
<body>
@section('sidebar') This is the master sidebar. @endsection
<div class="container">
@yield('content')
</div>
</body>
</html>
- another issue is some of the blade parts ( in the example above ) did not get formatted as expected, what is expected is something like this:
@section('sidebar')
This is the master sidebar.
@endsection
The thing is, I need the blade syntax highlighting which I can only see it in blade language.. Maybe If you can make it easier for the user to be able to do something like this:
"unibeautify.language": {
"html": [
"htm",
"blade"
],
},
Thanks for your time
Thank you for the details comment! This helps a lot.
https://github.com/Glavin001/atom-beautify/pull/2087 has an interesting solution to formatting Blade code. This is something which could be migrated to Unibeautify.
cc @szeck87
The thing is, I need the blade syntax highlighting which I can only see it in blade language.. Maybe If you can make it easier for the user to be able to do something like this:
"unibeautify.language": { "html": [ "htm", "blade" ], },
I could use such a feature to configure HTML+PHP to be formatted with the HTML rules. In my case it's a *.phtml file.
[2019-02-14 18:48:08.205] [exthost] [error] [Glavin001.unibeautify-vscode] provider FAILED
[2019-02-14 18:48:08.205] [exthost] [error] Error: Beautifiers not found for Language: HTML+PHP