Commit Graph

40 Commits

Author SHA1 Message Date
Adriaan Zonnenberg
af6d92c47d feat: allow loading preprocessors only if the file uses them
When g:vue_pre_processors is set to 'auto', register pre-processors
automatically based on the file's contents, when the file is first
opened.

This works towards #128
2019-07-29 22:27:00 +02:00
Adriaan Zonnenberg
00d77ae375 refactor: Make syntax definition more similar to indent definition 2019-07-24 23:39:08 +02:00
Adriaan Zonnenberg
18c4211bd6 Deprecate g:vue_disable_pre_processors
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.
2019-07-24 21:01:57 +02:00
Ian Emnace
033df1b169 Enforce order of pre-processor syntax files
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).
2019-03-19 14:50:15 +08:00
Ian Emnace
ba9a3dbc4e Allow for configurable g:vue_pre_processors
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.
2019-03-19 13:44:46 +08:00
Adriaan Zonnenberg
6e90d9ed5a Allow newlines after a tag name
Closes #108
2018-05-25 23:32:56 +02:00
Adriaan Zonnenberg
a279172752 Fix #68 - change load order of syntax files
I'm not sure what's the root cause of this, but this seems to work.
2018-03-03 19:47:17 +01:00
Adriaan Zonnenberg
fffb29a31a Fix #96 - support custom html tag names 2018-02-22 22:21:07 +01:00
Jacob Merizian
568f5a2762 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
2017-07-21 11:07:04 +02:00
z1lk
aaf2a641b2 Adds a single line to register haml as a template language (#67) 2017-04-28 01:47:30 +02:00
akh
27dc461cb4 v- @ : directives support (#66) 2017-04-17 23:01:57 +02:00
Adriaan Zonnenberg
b5c8e6f330 Highlight the surrounding tags correctly
Removes omit_attr argument from s:register_language(), because html,
javascript, and css regions were the only ones that used it, and they
are now handled by syntax/html.vim.

`runtime! syntax/html.vim` also has the advantage that we can hook into
the html syntax, meaning that we can add stuff like highlighting
javascript expressions inside vue directives, and add our own html
attributes.

Also removes the start of line limitation introduced in previous commit
2017-03-26 21:25:20 +02:00
Adriaan Zonnenberg
32d2c0a943 Easier way to define new languages
Add more test cases

Also fixed some style issues

TODO: split tests up in multiple files, e.g. test/test_html_syntax.vader
2017-03-26 21:23:52 +02:00
Adriaan Zonnenberg
cdd07e6497 Fix template pattern (#57) 2017-03-15 12:15:24 +01:00
Eduardo San Martin Morote
81ada6a73f Load typescript only if it exists
Fix #56
2017-03-14 18:50:14 +01:00
Eduardo San Martin Morote
b60c475d42 Fix #56 2017-03-14 18:47:17 +01:00
Esdras Mayrink
4f837e5027 [typescript] Extra attributes on the script tag 2017-03-14 11:10:34 -03:00
Esdras Mayrink
8d3dc46181 Better support for Typescript syntax
Now we can define typescript syntax region by:
<script ts>...</script>
<script lang="ts">...</script>
<script lang="typescript">...</script>
2017-03-13 21:55:11 -03:00
Esdras Mayrink
51b18f8b90 Fix TS support
Just add an attribute to the script tag, like this: <script ts></script>
lang="typescript" confundes the webpack loader
2017-03-11 17:11:06 -03:00
Esdras Mayrink
404787aae2 Add support for typescript and improve html support 2017-03-11 16:56:47 -03:00
Eduardo San Martin Morote
f75a55ef19 Remove attrs limitation on style tag (#53)
* Remove attrs limitation on style tag

Closes #52
Style tags can actually have any amount of extra tags, so adding the
scoped tags is just too limiting.

* Improve attribute patterns
2017-03-08 00:24:40 +01:00
Adriaan Zonnenberg
0d5a392a11 Use unlet! instead of unlet
A bang after unlet suppresses the error if there is no such variable,
which removes the need for checking if the variable exists.
2017-02-19 22:10:05 +01:00
sliceofcode
42a2ec5243 Fix JavaScript highlighting 2017-01-08 21:45:32 -08:00
Evgeny Zislis
ab44921113 add slm language support 2016-12-25 15:38:07 +02:00
Larry Wang
0b528ff0ea add ' ' support for pug, jade, stylus, scss, sass & less 2016-12-17 22:40:54 +08:00
Seiya IZUMI
75771373fc Fix typo
`javacript` -> `javascript`
2016-08-29 00:13:13 +09:00
Eduardo San Martin Morote
7ecc094f6a Improve compatibility with NerdCommenter @xream
Closes #18
2016-08-21 23:11:31 +02:00
Ægir Örn Símonarson
4333b6508b Only unlet b:current_syntax if it is set. 2016-07-24 16:39:37 +00:00
Eduardo San Martin Morote
092aac985f Add babel support for lang 2016-06-29 13:51:33 +02:00
David Wong
40ff244060 add SCSS support 2016-04-19 23:48:44 +08:00
clovery
1df472d227 support <script type="text/babel"> 2016-04-19 17:58:47 +08:00
Eduardo San Martin Morote
4adfb9ba99 Fix jade syntax in vue files
The pug package isn't ready yet so you still need to use the jade
package for vue files. We can still apply the pug syntax to the regions
2016-02-21 11:29:23 +01:00
Eduardo San Martin Morote
348733202c Renamed jade to pug
Fixes #8
Alse see https://github.com/pugjs/jade/issues/2184
You should now replace your jade loaders by the pug loaders
and also the digitaltoad/vim-jade by digitaltoad/vim-pug which is the
new vim syntax plugin for pug (mantained by the same person)
2016-02-21 11:16:18 +01:00
Eduardo San Martin Morote
b25434a981 Allow the use of <template v-if> inside of the <template>
Fix #6
It forces the user to indent the code correctly in order to detect the
englobbing template tag
2016-01-31 12:11:44 +01:00
Phillip Lanclos
d7c87db4fc Allow sass modifiers like sass?indentedSyntax 2016-01-28 14:08:33 -06:00
ryym
7602a715d6 Include syntax file only if it exists 2016-01-12 23:01:14 +09:00
David Bronke
f35b872e7c Added LESS support in the <style> tag.
Also, use `matchgroup=PreProc` to highlight the `<style>` tag, instead of applying the `less` syntax to it.
2016-01-08 14:08:34 -06:00
Hsiaoyi Hsu
37321e50c0 add sass syntax 2015-12-29 18:38:33 +08:00
Eduardo San Martin Morote
fa9091030b Added coffee, stylus and jade. Updated all files 2015-10-09 09:59:52 +02:00
W. Evan Sheehan
33ca5940c5 Add basic syntax files
- Set the filetype to "vue" for files with a .vue extension
 - Define regions for <template>, <style>, and <script> tags
 - Include HTML, CSS, and JavaScript syntax highlighting for the <template>,
   <style>, and <script> regions
2015-02-21 16:57:56 -05:00