shufo / vscode-blade-formatter Goto Github PK
View Code? Open in Web Editor NEWAn opinionated Blade file formatter for VSCode
Home Page: https://marketplace.visualstudio.com/items?itemName=shufo.vscode-blade-formatter
License: MIT License
An opinionated Blade file formatter for VSCode
Home Page: https://marketplace.visualstudio.com/items?itemName=shufo.vscode-blade-formatter
License: MIT License
Please write your blade template that occurs issues.
Any other informations
Please write your blade template that occurs issues.
Shows this error: Cannot invoke loadWASM more than once.
Doesn't formate any file.
Please write your blade template that occurs issues.
Any other informations
Is it possible to implement a format shortcut?
I'd like to use the extension with no "format Enabled", and use a shortcut (Shift+Alt+F or similar) to format the current file.
Please write your blade template that occurs issues.
Any other informations
let str_arr = [
@foreach($php_objs as $obj)
"{{$arr->prop}}"
@Endforeach
];
is not formatting.
Please write your blade template that occurs issues.
Any other informations
Please write your blade template that occurs issues.
Any other informations
Any other informations
PHP-CS-Fixer: Path mode "intersection" requires a config file be set. Please set one or change path mode to "override".
I use "force aligned" as the wrap attribute and the code down below
<script> var values = {!!json_encode($data['values']) !!}; </script>
is formatted into
<script>
var values = {
!!json_encode($data['values']) !!
}
;
</script>
and obviously, it causes an error.
the extension does not work at all
{{-- test --}}
becomes
{{-- test
--}}
@foreach ($models->groupBy("$sort.name") as $group => $data)
becomes
@foreach ($models->groupBy(" $sort.name") as $group => $data)
@extends('pages.dashboard.pages', [
'title' => __('Cards'),
'sortList' => [
'name' => __('Name'),
]
])
becomes
@extends('pages.dashboard.pages', [
'title' => __('Cards'),
'sortList' => [
'name' => __('Name'),
]
])
@php
with indentation gets flatten@php
$test = 'hello;
@endphp
becomes
@php
$test = 'hello;
@endphp
style, role, tabindex, aria-*, colspan
It's really great to see a fresh new blade formatter eventually, I've been waiting for it for ages, thx for awesome job, man!
Btw, I have quite a complex case of blade code, no blade formatter could process on it correctly. But the code is working fine, however it's a bit ugly. Here it is.
<header class="face <?= isset($face_class) ? $face_class : '' ?>">
<div class="container d-flex">
@if (isset($face_class) && $face_class === 'face-narrow')
<div class="col-md-7 face__wrapper">
@else
<div class="col-md-6 face__wrapper">
@endif
<h1 class="face__title">{{ $face_title }}</h1>
@isset ($face_subtitle)
<p class="face__subtitle">{{ $face_subtitle }}</p>
@endisset
@isset ($face_desc)
<span class="face__text">{!! $face_desc !!}
@endisset
@isset ($face_desc_mb_hide)
<span class="face__text d-none d-lg-inline"> {!!
$face_desc_mb_hide !!}</span>
@endisset
</span>
@isset ($face_btn_text)
<div class="face__button-box">
<a href="{{ $face_anchor or '#request-form' }}" class="btn_regular"
onclick="yaCounter.reachGoal('form'); return true;">{{ $face_btn_text }}</a>
@endisset
@isset ($clutch)
<script type="text/javascript"
src="https://widget.clutch.co/static/js/widget.js">
</script>
<div class="face__clutch clutch-widget"
data-url="https://widget.clutch.co" data-widget-type="2"
data-height="50" data-clutchcompany-id="861064"
{{ $clutch === 'dark' ? 'data-darkbg="1"' : '' }}>
</div>
@endisset
@isset ($face_btn_text)
</div>
@endisset
</div>
@if (isset($face_class) && $face_class === 'face-wide')
<div class="col-md-7 face__image-box">
@else
<div class="col-md-7 col-lg-6 face__image-box">
@endif
@isset ($face_image)
<picture>
@isset ($face_image_webp)
<source srcset="{{ $face_image_webp }}" type="image/webp">
@endisset
<img class="face__image" src="{{ $face_image }}" alt="Logo">
</picture>
@endisset
</div>
</div>
</header>
It'd be fantastic if your formatter can handle it someday. You can also notice an error /*escaped*/
after formatting the code.
Can't format blade: something goes wrong. Please check if the template is too complicated or not.
framework: laravel 7
Please write your blade template that occurs issues.
Any other informations
Supporting beautify.config would be great:
"beautify.config": {
"indent_size": 2,
"wrap_line_length": 140,
"wrap_attributes": "force-aligned"
},
Then it's a perfect extension!
Please write your blade template that occurs issues.
Any other informations
executing the command ALT + SHIFT + F shows the following message VS Code "Cannot invoke loadWASM more than once." and does not do any formatting.
The only thing I did was create a file "thing.blade.php" to start putting the internal structure of the file and when I wanted to format the code VS Code asked me to install a format for blade, so I looked for one and I found this and when I executed the command for format did nothing
Please write your blade template that occurs issues.
Any other informations
Tried this on a couple of blade templates and it stripped everything up to the first blade marker {{
. One had some HTML first and the other was a mix of HTML and PHP.
Please write your blade template that occurs issues.
Any other informations
Please write your blade template that occurs issues.
Any other informations
Please write your blade template that occurs issues.
Any other informations
Please write your blade template that occurs issues.
Any other informations
** @{{ item.product }} **
** it become @{{ item . product }} **
Any other information
Hi,
When I save my blade file, nothing happens.
Do we need to configure something ?
Thanks
Hi there,
Would it be possible to format code between php directive (@php ... @endphp) with php formatter ?
sometimetimes usefull, exemple for a multi-array $template var in wordpress gutenberg block..
a bit hard to read when flated, as blade-formatter remove the "manual" indent/format on save.
{{--
Title: Section featuredImg + 2cols
Category: lalibellule
Icon: admin-comments
Keywords: section columns image
Mode: preview
SupportsMode: false
SupportsMultiple: true
SupportsInnerBlocks: true
--}}
@php
$template = [
[ 'core/columns', ['className' => 'l-SiteRow l-SiteRow--332'], [
['core/column', ['className' => 'l-SiteCol'], [
['cgb/block-fib']
]],
[ 'core/column', ['className' => 'l-SiteCol'],[
[ 'core/paragraph', [ 'placeholder' => 'Entrer du contenu...' ] ],
]],
[ 'core/column', ['className' => 'l-SiteCol'],[
[ 'core/paragraph', [ 'placeholder' => 'Entrer du contenu...' ] ],
]],
]]
];
@endphp
<section data-{{ $block['id'] }} class="l-SectionCols">
<InnerBlocks template="<?= esc_attr( wp_json_encode($template)) ?>" />
</section>
Anyway, thank you for the best blade formatter out there !
Best.
Text colour is changing to white.
"indent_size": 4,
"wrap_line_length": 120,
"wrap_attributes": "auto"
Colour as provided by theme should be present.
@extends('layouts/app')
@section('content')
@if ($x)
asdasd
@endif
@endsection
Can't format blade: something goes wrong. Please check if template is too complicated or not. Or simplify template might solves issue.
try to format
update1: it happens when I set the "bladeFormatter.format.wrapAttributes" to "force-expand-multiline",
update2: after a file formatted once, all attempts to format throws this error! no matter what is the wrapAttribute value
Please write your blade template that occurs issues.
Any other informations
Please write your blade template that occurs issues.
Any other informations
Please write your blade template that occurs issues.
Any other informations
Are there any plans to allow users to set indent size? Personally, I prefer tabs to spaces and the extension doesn't seem to inherit the file's preferred spacing method.
memory allocation.
Any other informations
@push('scripts')
<script src="{{ asset('backend/plugins/dropzone/dropzone.min.js') }}"></script>
<script>
Dropzone.options.gallery = {
url: "...",
previewTemplate: $("#preview-template").html(),
dictDefaultMessage: "Drop files here or click to select",
addRemoveLinks: true,
uploadMultiple: true,
maxFilesize: 2,
filesizeBase: 1024,
acceptedFiles: "image/jpg,image/jpeg,image/png",
init: function () {
this.renderExistingServerFiles = function(files, fileUrls , response){
for (const file in files) {
if (Object.hasOwnProperty.call(files, file)) {
const element = files[file];
this.files.push(element);
this.displayExistingFile(element, fileUrls[file], null, null, true);
this.emit("processing", element);
this.emit("complete", element);
}
}
this.emit("successmultiple", files, response, false);
}
@isset($item->images)
let files = [];
let fileUrls = [];
let response = { status:"success", fileHashes: [], imageIds: []};
@foreach($item->images as $image)
@php
$imageUrl = asset('img/'.$image->image_hash);
$imagePath = public_path('img/'.$image->image_hash);
$imageMime = File::mimeType($imagePath);
$imageSize = File::size($imagePath);
$imageName = File::name($imagePath);
@endphp
files.push(
{
processing: true,
accepted: true,
name: "{{ $imageName }}",
size: {{ $imageSize }},
type: '{{ $imageMime }}',
status: Dropzone.SUCCESS,
},
);
fileUrls.push("{{ $imageUrl }}")
response.fileHashes.push("{{ $image->image_hash }}")
response.imageIds.push("{{ $image->id }}")
@endforeach
this.renderExistingServerFiles(files, fileUrls, response);
@endisset
},
}
</script>
@endpush
The formatter should be able to format blade code inside script tags.
Blade directives used inside java script tags causes issues with the formatter thereby causing it to fail.
Please write your blade template that occurs issues.
Any other informations
<!--
Tailwind UI components require Tailwind CSS v1.8 and the @tailwindcss/ui plugin.
Read the documentation to get started: https://tailwindui.com/documentation
-->
OS: Windows 10
VSCode: 1.51.1
V-B-F: 0.6.1
Every time I save, paste or manually apply formatting any comments are indented over and over beyond the 4-space setting.
Changing the "Wrap Attributes" setting does not have an effect.
Comments should only be indented once at the given space/tab setting.
<!--
Tailwind UI components require Tailwind CSS v1.8 and the @tailwindcss/ui plugin.
Read the documentation to get started: https://tailwindui.com/documentation
-->
<div>
<tr class="flex flex-col items-start md:table-row justify-center mb-10
sm:hover:bg-gray-100">
<td class="whitespace-no-wrap w-full">
<div class="bg-blue-100 inline-block py-1 px-2 text-xs md:hidden rounded">Title</div>
<div class="items-center py-3 px-6">
<div class="text-sm font-medium text-gray-900">
{{ $vacancy->title }}
</div>
</div>
</td>
<td class="whitespace-now-rap w-full">
<div class="bg-blue-100 inline-block py-1 px-2 text-xs md:hidden rounded">Status</div>
<div class="items-center py-3 px-6">
<x-badges.error>Disabled</x-badges.error>
</div>
</td>
<td class="whitespace-no-wrap w-full">
<div class="bg-blue-100 inline-block py-1 px-2 text-xs md:hidden rounded">Subscription period</div>
<div class="items-center py-3 px-6">
<div class="text-sm font-medium text-gray-900 whitespace-nowrap">
@empty($vacancy->subscription)
No subscription
@else
{{ $vacancy->subscription }}
@endempty
</div>
</div>
</td>
<td class="whitespace-no-wrap w-full">
<div class="bg-blue-100 inline-block py-1 px-2 text-xs md:hidden rounded">Created At</div>
<div class="items-center py-3 px-6">
<div class="text-sm font-medium text-gray-900 whitespace-nowrap">
{{ $vacancy->created_at->format('d.m.Y h:i:s') }}
</div>
</div>
</td>
<td class="flex px-6 py-2 md:py-4 w-full bg-gray-100 md:bg-transparent justify-evenly">
<button wire:click="cloneVacancy({{ $vacancy->id }})" class="inline-block cursor-pointer p-1 border border-transparent transition duration-500 ease-in-out hover:border-green-400 text-green-500 rounded mr-2 focus:bg-green-400 focus:outline-none focus:text-white" title="Clone vacancy">
<svg class="w-5 h-5" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z" />
</svg>
</button>
<button wire:click="redirectToVacancyEditForm" class="inline-block cursor-pointer p-1 text-indigo-500 focus:text-white focus:outline-none focus:bg-indigo-400 border border-transparent transition duration-500 ease-in-out hover:border-indigo-400 rounded mr-2" title="Edit vacancy">
<svg class="w-5 h-5" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z" />
</svg>
</button>
@if ($confirmDelete == $vacancy->id)
<button wire:click="removeVacancy" class="inline-block cursor-pointer text-white bg-red-400 focus:text-red-400 focus:border-red-400 focus:outline-none focus:bg-transparent py-1 px-2 border border-red-400 transition duration-500 ease-in-out text-base font-semibold hover:border-red-500 hover:bg-red-500 rounded" title="Confirm delete">
Sure?
</button>
@else
<button wire:click="$emitUp('confirmVacancyDelete', {{ $vacancy->id }})" class="inline-block cursor-pointer text-red-500 focus:text-white focus:outline-none focus:bg-red-400 p-1 border border-transparent transition duration-500 ease-in-out hover:border-red-400 rounded" title="Delete vacancy">
<svg class="w-5 h-5" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
@endif
</td>
</tr>
</div>
Environment: Development
When saving the item.blade.php file I get the error "Cannot invoke loadWASM more than once". I use Laravel 8 with Jetstream.
Please write your blade template that occurs issues.
Any other informations
is that possible ? the format settings are under HTML › Format
Please write your blade template that occurs issues.
Any other informations
Please write your blade template that occurs issues.
Any other informations
Please write your blade template that occurs issues.
Any other informations
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.