From f501cd6993eecfe7e1d8df4cd110565ec04914b9 Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Thu, 13 Feb 2020 11:30:47 +0100 Subject: [PATCH 1/2] Added support for @empty & @endempty --- blade.sublime-syntax | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/blade.sublime-syntax b/blade.sublime-syntax index 4bdc539..2c5cc5b 100644 --- a/blade.sublime-syntax +++ b/blade.sublime-syntax @@ -90,7 +90,7 @@ contexts: pop: true - include: 'scope:source.php' - - match: '(\s{0}|^)(\@)\b(acfrepeater|auth|block|break|can|cannot|canany|choice|case|component|continue|dd|debug|dump|each|elsecan|elsecannot|elsecanany|elseif|embed|error|extends|for|foreach|forelse|guest|hasSection|hipchat|if|isset|include|includeIf|includeWhen|inject|lang|layout|macro|macrodef|method|minify|partial|php|push|render|section|servers|set|slack|slot|stack|story|switch|task|unless|unset|while|wpposts|yield)\b(?=(|\s*|)\(\()' + - match: '(\s{0}|^)(\@)\b(acfrepeater|auth|block|break|can|cannot|canany|choice|case|component|continue|dd|debug|dump|each|elsecan|elsecannot|elsecanany|elseif|embed|error|extends|for|foreach|forelse|guest|hasSection|hipchat|if|isset|empty|include|includeIf|includeWhen|inject|lang|layout|macro|macrodef|method|minify|partial|php|push|render|section|servers|set|slack|slot|stack|story|switch|task|unless|unset|while|wpposts|yield)\b(?=(|\s*|)\(\()' captures: 0: punctuation.section.embedded.php 2: constant.other.inline-data.html @@ -102,7 +102,7 @@ contexts: pop: true - include: 'scope:source.php' - - match: '(\s{0}|^)(\@)\b(acfrepeater|auth|block|break|can|cannot|canany|choice|case|component|continue|dd|debug|dump|each|elsecan|elsecannot|elsecanany|elseif|embed|error|extends|for|foreach|forelse|guest|hasSection|hipchat|if|isset|include|includeIf|includeWhen|inject|lang|layout|macro|macrodef|method|minify|partial|php|push|render|section|servers|set|slack|slot|stack|story|switch|task|unless|unset|while|wpposts|yield)\b(?=(|\s*|)\()' + - match: '(\s{0}|^)(\@)\b(acfrepeater|auth|block|break|can|cannot|canany|choice|case|component|continue|dd|debug|dump|each|elsecan|elsecannot|elsecanany|elseif|embed|error|extends|for|foreach|forelse|guest|hasSection|hipchat|if|isset|empty|include|includeIf|includeWhen|inject|lang|layout|macro|macrodef|method|minify|partial|php|push|render|section|servers|set|slack|slot|stack|story|switch|task|unless|unset|while|wpposts|yield)\b(?=(|\s*|)\()' captures: 0: punctuation.section.embedded.php 2: constant.other.inline-data.html @@ -114,7 +114,7 @@ contexts: pop: true - include: 'scope:source.php' - - match: '(\s{0}|^)(\@)\b(acfend|after|append|auth|break|breakpoint|continue|csrf|default|else|empty|endswitch|endafter|endauth|endblock|endcan|endcannot|endcanany|endcomponent|endembed|endempty|enderror|endfor|endforeach|endforelse|endguest|endif|endisset|endmacro|endmarkdown|endminify|endpartial|endpush|endsection|endsetup|endslot|endstory|endtask|endunless|endwhile|guest|markdown|overwrite|parent|setup|show|stop|verbatim|endverbatim|wpempty|wpend|wpquery)\b' + - match: '(\s{0}|^)(\@)\b(acfend|after|append|auth|break|breakpoint|continue|csrf|default|else|empty|endswitch|endafter|endauth|endblock|endcan|endcannot|endcanany|endcomponent|endembed|endempty|enderror|endfor|endforeach|endforelse|endguest|endif|endisset|endempty|endmacro|endmarkdown|endminify|endpartial|endpush|endsection|endsetup|endslot|endstory|endtask|endunless|endwhile|guest|markdown|overwrite|parent|setup|show|stop|verbatim|endverbatim|wpempty|wpend|wpquery)\b' scope: custom.compiler.blade.php captures: 0: punctuation.section.embedded.php From fe7dc7f9d34a37a10578fc72d7983d957fce7faa Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Thu, 13 Feb 2020 11:31:22 +0100 Subject: [PATCH 2/2] Added test for @empty & @endempty --- test.blade.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test.blade.php b/test.blade.php index 55206e6..dd42914 100644 --- a/test.blade.php +++ b/test.blade.php @@ -101,6 +101,10 @@ Hello, {{ $name }}. @endisset +@empty($name) + Hello, {{ $name }}. +@endempty + @unless (Auth::check()) You are not signed in. @endunless @@ -401,7 +405,7 @@ @endswitch {{-- Complex conditional --}} -@if(($x == true) && ($y == false)) +@if(($x == true) && ($y == false)) foo @endif @@ -422,4 +426,4 @@ {{-- Validation Errors --}} @error('title') -@enderror \ No newline at end of file +@enderror