Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Interpolation broken in eco #38

jneen opened this Issue Jul 14, 2011 · 10 comments


None yet
2 participants

jneen commented Jul 14, 2011

This is one that I struggled with for a long time, and I'm not exactly sure how to fix it. To reproduce, open a file with the extension .html.eco, and type:

<% { a: 1, b: 2 } %>
<% "#{ { a: 1, b: 2 } }" %>

The first line will be highlighted correctly, but the second gets very confused. My current guess as to why this is happening is that in coffee.vim, interpolation is configured with contains=TOP - but TOP in a coffeescript file is very different than TOP in an eco file. Ideas?


kchmck commented Jul 15, 2011

Yeah, looks like TOP is the problem. The only thing I can think of doing is to make a coffeeAll cluster with all the coffee syntaxes and use it instead of TOP.


jneen commented Jul 15, 2011

Yeah, I think that would work. I think TOP is one of those features that was around before people started using a lot of embedded templating languages. It's also too bad that it's completely global, and isn't contextualized by syn include. Oh well.


kchmck commented Jul 16, 2011

That wasn't too hard with

grep -E 'syn (match|region)' syntax/coffee.vim | awk '{print $3}' | uniq | grep -vE 'coffeeAssignSymbols|coffeeAssignBrackets|coffeeAssignString|coffeeTodo|coffeeHeregexComment|coffeeInterp|coffeeEscape' | tr '\n' ,


I want to make sure I'm getting the same bug as you, though, since it might also be a bug in .coffee files. This is what I see (I actually had to add unlet b:current_syntax above line 41 to get any coffee highlighting):



jneen commented Jul 18, 2011

Huh, interesting. The screenshot is exhibiting exactly the "broken" behavior I described - see how the expression within the interpolation isn't highlighted? Even worse, the interpolation "ends" at the } directly after the 2, and the rest is highlighted as a string. I'll post a better example with screenshots in a sec.


jneen commented Jul 18, 2011

Well, that's interesting - I seem to have uncovered another bug in interpolation:

syntax bug

Notice how, in the eco example, the inner object is not getting highlighted at all. But in both cases, the curly that's supposed to mark the end of the object literal is being highlighted as marking the end of the interpolation.


kchmck commented Jul 19, 2011

Alright, I think I finally fixed both of these. The second gave me problems because the html file added in 2bea011 includes coffee before eco, and including it twice breaks the fix for some reason.

I pushed to a fix-38 branch since d3f36e8 changes eco stuff and I want to make sure that looks good to you before going on master.

@jneen jneen added a commit to jneen/vim-coffee-script that referenced this issue Jul 20, 2011

@jneen jneen add an eco test (#38) 102d931

jneen commented Jul 20, 2011

Sweet, thanks! It all looks good to me except for the last example in the eco test I've added, where the close-interpolation curly doesn't seem to be highlighted at all.


kchmck commented Jul 21, 2011

It works on my end for some reason:

@kchmck kchmck added a commit that referenced this issue Jul 21, 2011

@jneen @kchmck jneen + kchmck add an eco test (#38) 0e60494

jneen commented Jul 21, 2011

.... huh. Bizarre. I say ship it anyways, but just in case, here's my version info:

% vim --version
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Mar 24 2011 07:07:34)
Included patches: 1-35
Modified by pkg-vim-maintainers@lists.alioth.debian.org
Compiled by buildd@
Huge version with GTK2-GNOME GUI.  Features included (+) or not (-):
+arabic +autocmd +balloon_eval +browse ++builtin_terms +byte_offset +cindent 
+clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments 
+conceal +cryptv +cscope +cursorbind +cursorshape +dialog_con_gui +diff 
+digraphs +dnd -ebcdic +emacs_tags +eval +ex_extra +extra_search +farsi 
+file_in_path +find_in_path +float +folding -footer +fork() +gettext 
-hangul_input +iconv +insert_expand +jumplist +keymap +langmap +libcall 
+linebreak +lispindent +listcmds +localmap +lua/dyn +menu +mksession 
+modify_fname +mouse +mouseshape +mouse_dec +mouse_gpm -mouse_jsbterm 
+mouse_netterm -mouse_sysmouse +mouse_xterm +multi_byte +multi_lang -mzscheme 
+netbeans_intg -osfiletype +path_extra +perl/dyn +persistent_undo +postscript 
+printer +profile +python/dyn +python3/dyn +quickfix +reltime +rightleft +ruby 
+scrollbind +signs +smartindent -sniff +startuptime +statusline -sun_workshop 
+syntax +tag_binary +tag_old_static -tag_any_white +tcl +terminfo +termresponse
 +textobjects +title +toolbar +user_commands +vertsplit +virtualedit +visual 
+visualextra +viminfo +vreplace +wildignore +wildmenu +windows +writebackup 
+X11 -xfontset +xim +xsmp_interact +xterm_clipboard -xterm_save 
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "$VIM/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -pthread -I/usr/include/atk-1.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/libdrm -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pixman-1   -pthread -DORBIT2=1 -D_REENTRANT -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pango-1.0 -I/usr/include/freetype2 -I/usr/include/atk-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/libpng12 -I/usr/include/libdrm -I/usr/include/libgnomeui-2.0 -I/usr/include/libart-2.0 -I/usr/include/gconf/2 -I/usr/include/gnome-keyring-1 -I/usr/include/libgnome-2.0 -I/usr/include/libbonoboui-2.0 -I/usr/include/libgnomecanvas-2.0 -I/usr/include/gtk-2.0 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/gnome-vfs-2.0 -I/usr/lib/gnome-vfs-2.0/include -I/usr/include/orbit-2.0 -I/usr/include/libbonobo-2.0 -I/usr/include/bonobo-activation-2.0 -I/usr/include/libxml2 -I/usr/include/gail-1.0 -I/usr/lib/gtk-2.0/include -I/usr/include/cairo -I/usr/include/pixman-1     -Wall -g -O2 -D_FORTIFY_SOURCE=1    -I/usr/include/tcl8.4  -D_REENTRANT=1  -D_THREAD_SAFE=1  -D_LARGEFILE64_SOURCE=1  -I/usr/lib/ruby/1.8/x86_64-linux -DRUBY_VERSION=18 
Linking: gcc -L/usr/lib/x86_64-linux-gnu    -L. -Wl,-Bsymbolic-functions -rdynamic -Wl,-export-dynamic  -Wl,-E  -Wl,--as-needed -o vim   -pthread -L/usr/lib/x86_64-linux-gnu -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lglib-2.0   -L/usr/lib/x86_64-linux-gnu   -lgnomeui-2 -lbonoboui-2 -lgnomevfs-2 -lgnomecanvas-2 -lgnome-2 -lpopt -lbonobo-2 -lbonobo-activation -lORBit-2 -lart_lgpl_2 -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgconf-2 -lgmodule-2.0 -lgobject-2.0 -lgthread-2.0 -lrt -lglib-2.0   -lXt -lncurses -lselinux   -lacl -lgpm -Wl,-E  -fstack-protector -L/usr/local/lib  -L/usr/lib/perl/5.10/CORE -L/usr/lib -ltcl8.4 -lieee -lruby1.8 -lrt -lm   

kchmck commented Jul 21, 2011

Alright, will do. It must be a patch between 35 and 206 or something. Thanks for reporting these!

@kchmck kchmck closed this Jul 21, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment