"less" syntax highlighting error

5 views
Skip to first unread message

Ti Strga

unread,
Jun 9, 2017, 1:47:46 PM6/9/17
to v...@vim.org, jen...@gmail.com
Using 8.0.596, playing with the Less markup language for the first
time (a preprocessor producing CSS for a webserver). The regular
expression controlling comment blocks has gone a bit wrong. I'm
cc'ing Alessandro Vioni, listed as the maintainer in that file.

In CSS, one can use C-style comments as blocks, which is useful for
disabling chunks:

/* blah blah blah this CSS didn't work so I disabled it
but am keeping it around because blah blah blah
some #kind of .selector {
awesome-factor: 9000;
}*/

And in Vim, it all turns the standard "comment block" color.

In Less, the same comment rules apply, but after the opening delimiter,
Vim only shows the rest of that same line as a comment. Using the
example above, this is "comment block" color:

/* blah blah blah this CSS didn't work so I disabled it

but this is all colored according to normal syntax rules:

but am keeping it around because blah blah blah
some #kind of .selector {
awesome-factor: 9000;
}*/

and of course it goes nuts. If that "but am keeping" line happens to
contain a single-quote, for example, the entire rest of the file turns
"quoted text" color.

I looked very briefly at less.vim's "syn region" lines for comment blocks,
but it's trying to do something more clever than the plain 'cssComment'
region block. I see something handling end-of-line '//' comments, but I
am ignorant of the rest of the syntax there or what its goal might be; it's
been too long since I studied vimscript.
Reply all
Reply to author
Forward
0 new messages