Allows users to turn off preprocessor language parsing for better performance (#79)

* removed preprocessing langs from registration

I'm not sure if this will work

* add back support for pre-processors

adds back support for preprocessors, but keeps vim fast when not in use

* completely removed support for preprocessors

testing to see if completely removing preprocessor language registrations will make syntime reports more performant

* added back conditional support

conditional support should work now

* just testing remove all preprocessor support

* I think this will work

* i found the actual bug

some regex statements are being checked several times

* quick fix for now

I only apply a quick fix until I can get to the root of the problem. For this, in order to turn off the preprocessors which seem to bog down vim, just put `let g:avoid_pre_processors = 1` in the .vimrc (or neovim equivalent).

* forgot endif statement

* testing behavior

* removed line to test behavior

* Update readme.md

* Update readme.md

* Update vue.vim

* Update vue.vim

* Update readme.md
This commit is contained in:
Jacob Merizian
2017-07-21 05:07:04 -04:00
committed by Eduardo San Martin Morote
parent c7f975ddb8
commit 568f5a2762
2 changed files with 16 additions and 10 deletions

View File

@@ -125,3 +125,7 @@ endfunction
```
</details>
### _Vim gets slows down when using this plugin_ How can I fix that?
Add `let g:vue_disable_pre_processors=1` in your .vimrc to disable checking for prepocessors. When checking for prepocessor languages, multiple syntax highlighting checks are done, which can slow down vim. This variable prevents vim-vue from supporting **every** prepocessor language highlighting.

View File

@@ -40,16 +40,18 @@ function! s:register_language(language, tag, ...)
endif
endfunction
call s:register_language('pug', 'template', s:attr('lang', '\%(pug\|jade\)'))
call s:register_language('slm', 'template')
call s:register_language('handlebars', 'template')
call s:register_language('haml', 'template')
call s:register_language('typescript', 'script', '\%(lang=\("\|''\)[^\1]*\(ts\|typescript\)[^\1]*\1\|ts\)')
call s:register_language('coffee', 'script')
call s:register_language('stylus', 'style')
call s:register_language('sass', 'style')
call s:register_language('scss', 'style')
call s:register_language('less', 'style')
if !exists("g:vue_disable_pre_processors") || !g:vue_disable_pre_processors
call s:register_language('pug', 'template', s:attr('lang', '\%(pug\|jade\)'))
call s:register_language('slm', 'template')
call s:register_language('handlebars', 'template')
call s:register_language('haml', 'template')
call s:register_language('typescript', 'script', '\%(lang=\("\|''\)[^\1]*\(ts\|typescript\)[^\1]*\1\|ts\)')
call s:register_language('coffee', 'script')
call s:register_language('stylus', 'style')
call s:register_language('sass', 'style')
call s:register_language('scss', 'style')
call s:register_language('less', 'style')
endif
syn region vueSurroundingTag contained start=+<\(script\|style\|template\)+ end=+>+ fold contains=htmlTagN,htmlString,htmlArg,htmlValue,htmlTagError,htmlEvent
syn keyword htmlSpecialTagName contained template