leafOfTree / vim-vue-plugin

Vim syntax and indent plugin for .vue files
The Unlicense
177 stars 9 forks source link

Number with munis sign not highlighted #12

Closed amerov closed 5 years ago

amerov commented 5 years ago

Screenshot from 2019-06-26 16-16-30 -10 recognized as a vueScript

leafOfTree commented 5 years ago

Hi, as vueScript is a basic syntax for all wrapped in <script>, it should be related to the syntax of javascript. Could you test number syntax in a normal javascript file? And what javascript syntax plugin do you use? Here is my syntax highlighting:

default javascript syntax: LTvKKH7CZD

with 'pangloss/vim-javascript' enabled: 8vNEgR9dIi

amerov commented 5 years ago

Hi, as vueScript is a basic syntax for all wrapped in <script>, it should be related to the syntax of javascript. Could you test number syntax in a normal javascript file? And what javascript syntax plugin do you use? Here is my syntax highlighting:

default javascript syntax: LTvKKH7CZD

with 'pangloss/vim-javascript' enabled: 8vNEgR9dIi

Normal js syntax is okay. I use 'pangloss/vim-javascript' My vimrc: https://github.com/amerov/dotfiles/blob/master/.config/nvim/init.vim

leafOfTree commented 5 years ago

Thank you for sharing your vimrc. I need more info to debug. There is a SynStack function in it. Could you move the cursor to -10 's - and 10 and

:call SynStack()

It will display all syntax applied to them. For the latest vim-javascript(It has been updated recently), there should be jsOperator for - and jsNumber for 10.

And try

:verb hi jsOperator
:verb hi jsNumber

to show detail info.

amerov commented 5 years ago

synStack result for 10: ['vueScript', 'jsObject', 'jsFuncBlock'] synStack result for -: ['vueScript', 'jsObject', 'jsFuncBlock', 'jsOperator']

:verb hi jsNumber                                                                                                                                                                           
jsNumber       xxx links to Number
        Last set from ~/.local/share/nvim/plugged/vim-javascript/syntax/javascript.vim
:verb hi jsOperator                                                                                                                                                                         
jsOperator     xxx links to Operator
        Last set from ~/.local/share/nvim/plugged/vim-javascript/syntax/javascript.vim
amerov commented 5 years ago

when let g:vim_vue_plugin_load_full_syntax=0 number with minus highlighting is ok. But html's data attributes isn't.

leafOfTree commented 5 years ago

Thank you for the feedback. I use gVim and will try Neovim to see what happens.

leafOfTree commented 5 years ago

Yes. let g:vim_vue_plugin_load_full_syntax=1 and using othree/html5.vim reproduce this error.

leafOfTree commented 5 years ago

othree/html5.vim uses syn iskeyword (see :h syn-iskeyword) that adds - to iskeyword option, causing -10 highlighting error. I have replaced - with $ for vue.

amerov commented 5 years ago

Screenshot from 2019-07-02 14-33-43 Now html's data attributes broken.

leafOfTree commented 5 years ago

I didn't consider the impact on HTML attributes(for which - is required in syntax keyword). Then I adjusted the javascript number highlighting pattern so both are satisfied now.

amerov commented 5 years ago

Thanks! Now current state is ok. Also I open issue for html5 plugin https://github.com/othree/html5.vim/issues/103