-
-
Notifications
You must be signed in to change notification settings - Fork 101
Allow granular control over loading pre-processor syntax files #133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow granular control over loading pre-processor syntax files #133
Conversation
Prior to this commit, there was a single Boolean option, g:vue_disable_pre_processors, which would only activate either *every* pre-processor syntax file or none of them at all. This was a known pain point when it comes to performance. On some machines, loading all the pre-processor syntax files could slow down Vim noticeably, hence the need for such an option in the first place. However, turning all of them off means having to live with no syntax highlighting at all if one uses a pre-processor language. This commit introduces another option: g:vue_pre_processors. This is a List of names of pre-processor syntaxes, e.g. ['pug','scss']. If a user provides this option, only the named pre-processor syntax files will be loaded. This change still allows for g:vue_disable_pre_processors: If g:vue_disable_pre_processors is truthy, pre-processor syntax files aren't loaded regardless of the value of g:vue_pre_processors.
The change in commit ba9a3db is documented in the README, to augment the information regarding pre-processor languages and g:vue_disable_pre_processors.
Tests are failing. I'll fix shortly. |
The plugin's current behavior is reliant on the order of loading pre-processor syntax files. In particular, Vader tests are failing for SCSS snippets; SASS syntax identifiers are applied instead. Unfortunately, no ordering information can be embedded in a Dictionary, so s:language_config must be turned into a List. In the unconfigured case (no g:vue_disable_pre_processors, no g:vue_pre_processors), pre_processors can be initialized to a well-ordered List of languages (ordered as they appear in s:language_config), instead of the unstable keys() on a dict. Random access of language config is faster from a dict, though, so a dict is rebuilt in s:language_dict. Going through the s:language_config List for every pre-processor in pre_processors is O(m * n), as opposed to building s:language_dict once then looping through pre-processors once for O(m + n) (since dict access is constant time).
Anticipating posva/vim-vue#133 which should resolve perf issues with this plugin coc-vetur provides the autocomplete for Vue SFC.
Anticipating posva/vim-vue#133 which should resolve perf issues with this plugin coc-vetur provides the autocomplete for Vue SFC.
Anticipating posva/vim-vue#133 which should resolve perf issues with this plugin coc-vetur provides the autocomplete for Vue SFC. Stop coc.nvim from autoupdating coc-vetur on startup because I run multiple vim/nvim everyday. I don't use spacemacs because of autoupdate on startup.
Anticipating posva/vim-vue#133 which should resolve perf issues with this plugin coc-vetur provides the autocomplete for Vue SFC. Stop coc.nvim from autoupdating coc-vetur on startup because I run multiple vim/nvim everyday. I don't use spacemacs because of autoupdate on startup.
Is this PR ready? |
Yeah, this should be ready to merge. I have actually been holding off on this because I wanted to see what I could do with #128, but so far I haven't really had the time to work on that. I'll have a further look at this PR tonight and merge it in. I'm also thinking of merging in the work on the performance-enhancement branch, and enable that when |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks 👌 to me.
It was superseded by g:vue_pre_processors (#133) I could add a message if g:vue_disable_pre_processors is set, asking people to update their config to the new variable, but I'd rather not interrupt people's workflows.
You can now set |
In addition to
g:vue_disable_pre_processors
, which is an "all or nothing" approach to loading pre-processor syntax files, ag:vue_pre_processors
option is exposed as well. This is a List of names of pre-processor syntaxes to load, to allow the user to enjoy syntax highlighting for one or two pre-processor languages without incurring the performance penalty of loading all of them at the same time.Notable reasons not to merge this:
g:vue_pre_processors
altogether.In the meantime, however, as none of the above solutions are fleshed out as of yet (particularly in the context of syntax), this change could be a way to mitigate the issue.