-
Notifications
You must be signed in to change notification settings - Fork 4
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
Code between { } of a map/grep doesn't get hilighted #7
Comments
@emanrsu thanks for this report. At the moment you have to choose between highlighted DATA content for Mojolicious apps and highlighted grep/map blocks. You may find the following line in your .vimrc:
And remove it. DATA section won't be highlighted anymore, but grep/map blocks would. If this really annoys you, feel free to investigate and fix it. Luck |
This code in test.hrml.ep not proper highlighted too:
|
|
I experience a seemingly related problem (and I assume so because removing the As seen in the picture, the first method is fine, the second has the problem curly braces (twice actually though once is enough), and the third method continues with broken highlighting. |
I did some tinkering about with this last night and this morning - I managed to generate the following patch to solve the issue on a stupid little Mojolicious::Lite example: diff --git after/syntax/perl/MojoliciousLite.vim after/syntax/perl/MojoliciousLite.vim
index e1748e0..6ac761d 100644
--- after/syntax/perl/MojoliciousLite.vim
+++ after/syntax/perl/MojoliciousLite.vim
@@ -21,15 +21,6 @@ if !exists("mojo_highlight_data")
finish
endif
-if !exists("b:current_syntax")
- echoerr "MojolisiousTemplate can only be included in existing syntax"
- finish
-endif
-
-" Store current syntax name
-let cs = b:current_syntax
-unlet b:current_syntax
-
if !exists("mojo_disable_html")
unlet! b:current_syntax
syn include @Html syntax/html.vim
@@ -45,6 +36,3 @@ syn region MojoFileName start=/@@/ end="$" keepend contains=MojoFileNameStart co
" Push Template sections and HTML syntax into @perlDATA cluster
syn cluster perlDATA add=@Html,MojoFileContainer
-
-" Revert current syntax name
-let b:current_syntax = cs
diff --git syntax/epl.vim syntax/epl.vim
index 4d69546..9534e53 100644
--- syntax/epl.vim
+++ syntax/epl.vim
@@ -7,25 +7,9 @@
" License: Artistic 2.0
" Original version: vti <[email protected]>
-if exists("perl_fold")
- let b:bfold = perl_fold
- unlet perl_fold
-endif
-
" Clear previous syntax name
unlet! b:current_syntax
-" Include Perl syntax intp @Perl cluster
-syntax include @Perl syntax/perl.vim
-
-" This groups are broken when included
-syn cluster Perl remove=perlFunctionName,perlElseIfError
-
-if exists("b:bfold")
- let perl_fold = b:bfold
- unlet b:bfold
-endif
-
" Begin and end of code blocks
syn match MojoStart /<%=\{0,2}/ contained
syn match MojoSingleStart /^\s*%=\{0,2}/ contained
@@ -34,8 +18,8 @@ syn match MojoEnd /=\{0,1}%>/ contained
syn cluster Mojo contains=MojoStart,MojoEnd
" Highlight code blocks
-syn region PerlInside keepend start=+<%=\{0,2}+hs=s end=+=\{0,1}%>+he=s-1,me=s-1 contains=MojoStart,@Perl nextgroup=MojoEnd
-syn region PerlInside keepend start=+^\s*%=\{0,2}+hs=s end=+$+ contains=MojoSingleStart,@Perl
+syn region PerlInside keepend start=+<%=\{0,2}+hs=s end=+=\{0,1}%>+he=s-1,me=s-1 contains=MojoStart,@perlTop nextgroup=MojoEnd
+syn region PerlInside keepend start=+^\s*%=\{0,2}+hs=s end=+$+ contains=MojoSingleStart,@perlTop
if !exists("mojo_no_helpers") Please give this a try and let me know if it works for other, larger codebases! I think the problem was because all the action is happening in an |
Anything between map/grep's curly brackets is not properly hilighted (no colour at all).
E.g.: grep { /$this_does_not_get_hilighted/i } @array;
The text was updated successfully, but these errors were encountered: