ap / vim-css-color

Preview colours in source code while editing
http://www.vim.org/scripts/script.php?script_id=5056
MIT License
1.79k stars 80 forks source link

Support for othree/yajs.vim #113

Closed ap closed 5 years ago

ap commented 5 years ago
Plug 'ap/vim-css-color', { 'for': ['javascript.jsx', 'html', 'htmldjango'] }

Originally posted by @Fandekasp in https://github.com/ap/vim-css-color/issues/89#issuecomment-500723793

ap commented 5 years ago

@Fandekasp: If you move the cursor into a string that should be highlighted but isn’t and issue the following command, what does it say?

:echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
AdrienLemaire commented 5 years ago

@ap thanks for the quick follow-up :heart:

Line not highlighted:

      teal: "#00aed7", //{

['javascriptObjectLiteral', 'javascriptObjectLiteral', 'javascriptObjectLiteral', 'javascriptString']

Line highlighted:

        //100: "#e6fffa", 

['javascriptObjectLiteral', 'javascriptObjectLiteral', 'javascriptObjectLiteral', 'javascriptLineComment', 'BGe6fffa']
ap commented 5 years ago

The JS(X) syntax plugin you are using is not yet supported, only the Vim stock Javascript syntax and and pangloss/vim-javascript.

You get colours in comments anyway because group names are not case sensitive and the Vim stock Javascript syntax uses javaScriptLineComment – which happens to match javascriptLineComment case insensitively.

But the stock syntax has only javaScriptStringS and javaScriptStringD and nothing that would match javascriptString, so that case goes uncovered.

(And pangloss’ syntax uses js as its group name prefix, so it doesn‘t come up here at all.)

What plugin are you using?

AdrienLemaire commented 5 years ago

@ap I see. Here are the plugins I use for js.

Plug 'othree/yajs.vim', { 'for': 'javascript' }                               
Plug 'mxw/vim-jsx', { 'for': 'javascript' } 
ap commented 5 years ago

There you go. Share and enjoy 🙂

ap commented 5 years ago

Whoops.

AdrienLemaire commented 5 years ago

Many thanks @ap!