luochen1990 / rainbow

Rainbow Parentheses Improved, shorter code, no level limit, smooth and fast, powerful configuration.
Apache License 2.0
1.78k stars 95 forks source link

[Bug] vim-rainbow breaks vim-polyglot jinja2 highlighting #135

Open horseinthesky opened 4 years ago

horseinthesky commented 4 years ago

Describe the bug

When vim-rainbow plugin is active it breaks jinja2 highlighting done by vim-polyglot.

To Reproduce

Put

Plug 'luochen1990/rainbow'
Plug 'sheerun/vim-polyglot'

let g:rainbow_active = 1

to your vimrc file.

Open login.j2 file:

            <login>
                <class>
                    <name>mon</name>
                    <permissions>secret</permissions>
                    <permissions>view</permissions>
                    <permissions>view-configuration</permissions>
                    <allow-commands>ping*|trace*|show*</allow-commands>
                </class>
                {% for user in users %}
                <user>
                    <name>{{ user.name }}</name>
                    {% if user.uid is defined %}
                    <uid>{{ user.uid }}</uid>
                    {% endif %}
                    <class>{{ user.class | default("super-user") }}</class>
                    <authentication>
                        {% if user.pass is defined %}
                        <encrypted-password>{{ user.pass }}</encrypted-password>
                        {% endif %}
                        {% if user.ssh_keys is defined %}
                        {% for key in user.ssh_keys %}
                        <ssh-rsa>
                            <name>ssh-rsa {{ key }}</name>
                        </ssh-rsa>
                        {% endfor %}
                        {% endif %}
                    </authentication>
                </user>
                {% endfor %}
            </login>

Check filetype with :set ft?. It'll show filetype=jinja2.

It will look like this: image

Do :RainbowToggle.

Now it will look like this: image

luochen1990 commented 4 years ago

What's your expecting result? Do you just want to disable rainbow for this file type or you want rainbow to highlight the parentheses inside {% %} or you want to highlight the tags outside the {% %}?

horseinthesky commented 4 years ago

What's your expecting result? Do you just want to disable rainbow for this file type or you want rainbow to highlight the parentheses inside {% %} or you want to highlight the tags outside the {% %}?

Expecting result is certainly not breaking syntax highlighting. I think the correct behavior is to highlight the parentheses inside {% %} as it is the main idea of this plugin.