izhangzhihao / intellij-rainbow-brackets

🌈Rainbow Brackets for IntelliJ based IDEs/Android Studio/HUAWEI DevEco Studio/Fleet
https://plugins.jetbrains.com/plugin/10080-rainbow-brackets
GNU General Public License v3.0
4.35k stars 202 forks source link

Jinja2 Mis-Paired Template Blocks #2707

Closed ZzhangYH closed 3 months ago

ZzhangYH commented 3 months ago

Have you checked the issues and discussions to ensure there are no duplicates?

Yes

Your programming languages

Python, Flask server with Jinja2

Free or paid?

Paid users

Expected Behavior

Hi there, I am happy to see that rainbow brackets is supporting Jinja2 templates! The highlight strategy is awesome, but it should be able to pair each {% ... %} blocks accordingly.

Current Behavior

Problem occurs with the color highlighting when there is an extends block at the very beginning. It is messing up with the order for the whole file scope. See below:

CleanShot 2024-01-22 at 11  27 19@2x

Code snippet for reproduce

{% extends 'base.html' %}

{% block title %}Setup Basics{% endblock %}
{% block header %}{{ session['job'] }}{% endblock %}

{% block status %}
    <div>
        <img src="{{ url_for('static', filename='setup/status-bar-1.svg') }}" alt="Status Bar">
    </div>
{% endblock %}

{% block content %}
    <form method="post">
        <label>Marking target</label>
        <input type="text" name="filename" id="filename" value="{{ request.form['filename'] }}"
               placeholder="Filename" required>
        <label>Compile settings</label>
        <input type="text" name="cArgs" id="cArgs" value="{{ request.form['cArgs'] }}"
               placeholder="Command line arguments" required>
    </form>
{% endblock %}

Your Environment

PyCharm 2023.3.2 (Professional Edition) Build #PY-233.13135.95, built on December 19, 2023 Licensed to Yuhan Zhang Subscription is active until September 26, 2024. For educational use only. Runtime version: 17.0.9+7-b1087.9 aarch64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. macOS 14.2.1 GC: G1 Young Generation, G1 Old Generation Memory: 2048M Cores: 8 Metal Rendering is ON Registry: debugger.new.tool.window.layout=true ide.experimental.ui=true Non-Bundled Plugins: com.markskelton.one-dark-theme (5.9.0) com.intellij.plugins.vscodekeymap (233.11799.188) name.kropp.intellij.makefile (233.13135.65) com.kagof.pokeprogress (2.1.1) izhangzhihao.rainbow.brackets (2024.1.0-233) com.intellij.ml.llm (233.13135.116) com.mallowigi (94.1.0) mobi.hsz.idea.gitignore (4.5.2)

izhangzhihao commented 3 months ago

Thanks for reporting, pls try this build snapshot: intellij-rainbow-brackets-2024.1.0-233.zip

image
ZzhangYH commented 3 months ago

Great! Everything is now working smoothly with this version.