cakebaker / scss-syntax.vim

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

Properties not properly highlighted #50

Closed alem0lars closed 9 years ago

alem0lars commented 9 years ago

As you can see in the screenshots below, some properties aren't properly highlighted..

napkin napkin 24-02-15 10 52 10 am

cakebaker commented 9 years ago

Hm, I can't reproduce the issue here. What version of Vim do you use? And do you use any other plugins that could interfere with the highlighting?

alem0lars commented 9 years ago

I am using the latest version of the scss-syntax plugin.

My VIm version is:

$ mvim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jan 29 2015 16:54:03)
MacOS X (unix) version
Included patches: 1-258
Compiled by Homebrew
Huge version with MacVim GUI.  Features included (+) or not (-):
+acl             +file_in_path    +mouse_sgr       +tag_binary
+arabic          +find_in_path    -mouse_sysmouse  +tag_old_static
+autocmd         +float           +mouse_urxvt     -tag_any_white
+balloon_eval    +folding         +mouse_xterm     +tcl
+browse          -footer          +multi_byte      +terminfo
++builtin_terms  +fork()          +multi_lang      +termresponse
+byte_offset     +fullscreen      -mzscheme        +textobjects
+cindent         -gettext         +netbeans_intg   +title
+clientserver    -hangul_input    +odbeditor       +toolbar
+clipboard       +iconv           +path_extra      +transparency
+cmdline_compl   +insert_expand   +perl            +user_commands
+cmdline_hist    +jumplist        +persistent_undo +vertsplit
+cmdline_info    +keymap          +postscript      +virtualedit
+comments        +langmap         +printer         +visual
+conceal         +libcall         +profile         +visualextra
+cryptv          +linebreak       +python          +viminfo
+cscope          +lispindent      -python3         +vreplace
+cursorbind      +listcmds        +quickfix        +wildignore
+cursorshape     +localmap        +reltime         +wildmenu
+dialog_con_gui  +lua             +rightleft       +windows
+diff            +menu            +ruby            +writebackup
+digraphs        +mksession       +scrollbind      -X11
+dnd             +modify_fname    +signs           -xfontset
-ebcdic          +mouse           +smartindent     +xim
+emacs_tags      +mouseshape      -sniff           -xsmp
+eval            +mouse_dec       +startuptime     -xterm_clipboard
+ex_extra        -mouse_gpm       +statusline      -xterm_save
+extra_search    -mouse_jsbterm   -sun_workshop    -xpm
+farsi           +mouse_netterm   +syntax
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "$VIM/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/Applications/MacVim.app/Contents/Resources/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_MACVIM -Wall -Wno-unknown-pragmas -pipe  -DMACOS_X_UNIX  -I/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/include/python2.7 -fno-strict-aliasing -fno-common -dynamic -I/usr/local/include -I/usr/local/opt/sqlite/include -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1     -I/System/Library/Frameworks/Tcl.framework/Headers  -D_REENTRANT=1  -D_THREAD_SAFE=1  -D_DARWIN_C_SOURCE=1
Linking: clang   -L. -L/usr/local/lib -L. -L/usr/local/lib -L/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config -lpython2.7 -framework CoreFoundation -L/usr/local/lib -o Vim -framework Cocoa -framework Carbon       -lm  -lncurses -liconv -framework Cocoa  -L/usr/local/lib -llua -fstack-protector  -L/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE -lperl -framework Python  -F/System/Library/Frameworks -framework Tcl -framework CoreFoundation -framework Ruby

I pasted a gist of a full sourcefile (https://gist.github.com/alem0lars/128e35a34bab0f275ada) that shows some problems. Just copy and paste in a VIm buffer and check if you see the problems I see. Those are:

Of course, I think the cursor problem of the screenshot above is just the same of animation-*..

Thanks for the support I really appreciate :)

cakebaker commented 9 years ago

Thanks for the example. So far I can only reproduce the issue with safe-map-get (plus there is an issue with the highlighting of null).

cakebaker commented 9 years ago

The things I could reproduce are fixed, but still no luck with reproducing the other issues... What plugins do you use?

alem0lars commented 9 years ago

I added details in issue #51

alem0lars commented 9 years ago

After the latest commits I am getting more problems..

I attach the screenshots below:

screen shot 2015-02-27 at 10 35 38 screen shot 2015-02-27 at 10 35 51 screen shot 2015-02-27 at 10 37 02 screen shot 2015-02-27 at 10 37 31 screen shot 2015-02-27 at 10 37 37 screen shot 2015-02-27 at 10 37 57 screen shot 2015-02-27 at 10 38 12

Thanks for the support :)

alem0lars commented 9 years ago

The plugins I'm using are listed in the following gist: https://gist.github.com/alem0lars/c28c9cf88a78c265753f

Thanks very much for the support.. I really appreciate it :) Ty

cakebaker commented 9 years ago

Thanks for the plugin list. I installed them, but there was no change in the highlighting, therefore they can probably be excluded as the cause of the issues...

Can you add the following lines to your .vimrc:

set laststatus=2
set statusline+=%{synIDattr(synID(line('.'),col('.'),1),'name')}

and then check what's returned when your cursor is on an animation-* property and on an unquote function? The expected values are cssAnimationProp and scssFunctionName.

alem0lars commented 9 years ago

I've just tried and the value returned is rainbow_r0 for both animation-* properties and unquote.

I think that the rainbow plugin is interfering.. ?

Ty

cakebaker commented 9 years ago

Yep, looks like it is the culprit. When I enable it I get the same issues as you reported...

alem0lars commented 9 years ago

Ok :)

Do you think the bad behaviour is in your plugin or it's a bad behaviour of rainbow (i.e. the issue should be reported to rainbow)?

Ty

cakebaker commented 9 years ago

Good question. My guess is that it is an issue with rainbow because I get the same behavior with CSS files. Maybe that's the reason for rainbow being disabled for CSS by default?

/cc @luochen1990

luochen1990 commented 9 years ago

Yes, when you use more than one plugin which defines syntax, there is chance that they conflict with each other. In rainbow , I defined region syntax for parentheses. so , if there is another plugin which need parentheses to be matched as region to contain other syntax parts, there will be a confliction.

but in rainbow, there is still a way to make thing all perfect, just need a little extra work: you can define parentheses with contains like this in the configuration:

    let g:rainbow_conf = {
    \   'separately': {
    \       'THE_FILE_TYPE': {
    \           'parentheses': ['start=/(/ end=/)/ contains=SOME_SYNTAX_NAME fold', 'start=/\[/ end=/\]/ contains=SOME_SYNTAX_NAME fold', 'start=/{/ end=/}/ contains=SOME_SYNTAX_NAME fold'],
            }
    \   }
    \}

where THE_FILE_TYPE and SOME_SYNTAX_NAME should be replaced. (to what ? I think @cakebaker will tell you :)

alem0lars commented 9 years ago

Ok, It this issue isn't caused by scss-syntax. So I think we can consider it as resolved.

Thanks @cakebaker @luochen1990 for the awesome support :+1:

cakebaker commented 9 years ago

@luochen1990 Thanks for your explanation.

@alem0lars As a starting point you could use the following for the contains part of start=/{/ end=/}/:

cssComment,cssInclude,cssFontDescriptor,scssAtRootStatement,scssComment,scssDefinition,scssProperty,scssSelector,scssVariable,scssImport,scssExtend,scssInclude,scssFunction,@scssControl,scssWarn,scssError,scssDebug,scssReturn fold

For the other two contains parts you probably only need scssFunction,scssVariable fold.

For the CSS stuff, I would use the snippet I mentioned in https://github.com/cakebaker/scss-syntax.vim/issues/50#issuecomment-76415209 to get the necessary element types.

luochen1990 commented 9 years ago

actually, there is a more elegant way to do this, define these syntax definition as a syntax group, this way, users can use the group name to define contains, such as contains=@SassSyntaxes.