cakebaker / scss-syntax.vim

Vim syntax file for scss (Sassy CSS)
386 stars 71 forks source link

"Font" in font-weight colored red #32

Closed moll closed 10 years ago

moll commented 10 years ago

Is it just me or is there a problem with parsing font-weight?

td.today { color: $today-color; font-weight: bold; }

Looks like this:

cakebaker commented 10 years ago

Hm, so far I can't reproduce it here. Do you use the latest version of scss.vim?

moll commented 10 years ago

It would seem so — just cloned the repo and confirmed it's in &rtp. I'm on MacVim 7.4 Snapshot 70 here.

The red font has the following syntax classes on it: cssDeprecated sassDefinition.

Hmm, it now seems to me it's related to iskeyword setting. When it includes a dash (-), it's colored correctly. But I don't think correct syntax highlighting should depend on that.

cakebaker commented 10 years ago

I think the syntax file is not loaded because you mention sassDefinition, which is defined in sass.vim. If you run :scriptnames, is there a path to the scss.vim?

moll commented 10 years ago

Thanks for the hint! Scss-syntax was indeed loaded a little later than Tim Pope's Haml.vim with its sass.vim and scss.vim. Disabling Haml.vim (thereby falling back on stock Haml syntax files) seemed to have fix the red font issue. Thank you!

Unfortunately, dashed words are still colored a bit wrong when iskeywords doesn't contain a dash:

font is cssFontProp scssDefinition and weight is scssProperty scssDefinition.

cakebaker commented 10 years ago

Ok, I'm able to reproduce the issue here. I had set lisp in my vimrc, which always included the dash.

cakebaker commented 10 years ago

Fixed in https://github.com/cakebaker/scss-syntax.vim/commit/f5697823f9f3e830228bfd45c4d7fcd521216bf0. Thanks for reporting.

moll commented 10 years ago

Umm, thanks, but set iskeyword+=- slipped in there. That's surely not the fix, right? I at least sure hope there is a proper fix as I personally do not want motion keys behavior changed.

cakebaker commented 10 years ago

Yes, you're right, iskeyword should be set in one's vimrc and so I removed it.

However, this introduces a new highlighting issue with function names starting with keywords. See for example https://github.com/cakebaker/scss-syntax.vim/blob/master/example.scss#L646. gray will be highlighted as a color whereas with-lightness will be highlighted as a function. This is afaik something you can't prevent without iskeyword (or redefining the keywords from css.vim as matches).

moll commented 10 years ago

:+1: for the revert.

I'm not too familiar with the sharing of responsibility — can this be fixed in css.vim and pushed upstream? And perhaps temporarily "redefined" as you say.

cakebaker commented 10 years ago

I think it is not worth the effort for such a minor issue. And with iskeyword there is a fix available.