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.45k stars 213 forks source link

Doesn't Color Parentheses In Go Template Actions #458

Closed lots0logs closed 3 years ago

lots0logs commented 4 years ago

Please check

Your programming language(s)

Go Templates

Expected Behavior

Parentheses inside actions should be colorized.

Current Behavior

Parentheses inside actions are not colorized.

Possible Solution

I think this might not be fixable without changes in JetBrains code. I opened this issue as well.

Code snippet for reproduce (for bugs)

{{ if and (or (contains $server.Hostname "cloud") (contains $server.Hostname "elegantthemes")) (hasSuffix $path `"^/"`) }}

Your Environment

=== About ===
Build version: PhpStorm 2020.2 EAP Build #PS-202.5958.28 June 25, 2020
Java version: 11.0.7+10-b944.13amd64
Operating System: Linux (5.4.0-40-generic, amd64)
JVM version: OpenJDK 64-Bit Server VM JetBrains s.r.o.
idea.config.path=/home/dustin/.config/JetBrains/PhpStorm2020.2
idea.system.path=/home/dustin/.cache/JetBrains/PhpStorm2020.2
idea.plugins.path=/home/dustin/.local/share/JetBrains/Toolbox/apps/PhpStorm/ch-0/202.5958.28.plugins
idea.log.path=/home/dustin/.cache/JetBrains/PhpStorm2020.2/log

=== System ===
Number of CPU: 24
Used memory: 628Mb 
Free memory: 441Mb 
Total memory: 1070Mb 
Maximum available memory: 2969Mb

=== Displays ===
Displays: 
Display 0: 2560x1440; scale: 1.00
Display 1: 2560x1440; scale: 1.00

=== Plugins ===
Custom plugins: [String Manipulation (8.0.191.000.2), YAML/Ansible support (0.9.5), Switch Component files (1.0), View Package Versions (1.2.0), Material Theme UI (5.3.3), Conventional Commit (0.15.1), Lua (1.0.127), OpenResty Lua Support (0.0.4), Ideolog (201.0.22.0), JSON Sorter (1.0.0-beta.3.4), React snippets (1.1.0), Theme Collection (0.8), JS Toolbox (1.9), Atom Material Icons (25.3), Code Time (2.2.9), Atom OneDark Theme (1.6), One Dark Native (1.5), Extra Icons (1.30.0.201), Case conversion (0.6.1), Makefile support (3.1.1), Code::Stats (1.0.9), Quick File Preview (1.6.3), CodeGlance (1.5.4), HashiCorp Terraform / HCL Language Support (0.7.9), Go Template (202.5958.22), Git Branch Cleaner (1.1.4), Shared Indexes (202.5958.22), Kubernetes (202.5958.22), Puppet (202.5958.22), Node.js Remote Interpreter (202.5958.19), Php Inspections (EA Extended) (4.0.4.1), deep-assoc-completion (2020.06.26.001), Rainbow Brackets (6.6)]
Disabled plugins:[Space (2019.2), CoffeeScript (202.5958.28), Settings Repository (202.5958.28), Vue.js (202.5958.28), Mercurial (202.5958.28), Haml (202.5958.28), PhpStorm Workshop (202.5958.28), CodeStream (7.0.2+45), Joomla! (202.5958.28), PHPT Support (202.5958.28), Vagrant (202.5958.28), Find Pull Request (1.7.1), nginx Support (0.1.9), Drupal (202.5958.28), DQL (202.5958.28), Perforce (202.5958.28), ASP (202.5958.28), One Dark theme (3.3.5), Angular and AngularJS (202.5958.28), Gray Theme (1.1.1), Subversion (202.5958.28)]
izhangzhihao commented 4 years ago

The PSI structure looks ok:

GO_TEMPLATE_FILE(0,122)
  GoTemplateStatementListImpl(STATEMENT_LIST)(0,122)
    GoTemplateIfStatementImpl(IF_STATEMENT)(0,122)
      PsiElement({{)('{{')(0,2)
      PsiWhiteSpace(' ')(2,3)
      PsiElement(if)('if')(3,5)
      PsiWhiteSpace(' ')(5,6)
      GoTemplateSimplePipelineImpl(SIMPLE_PIPELINE)(6,119)
        GoTemplateLiteralExprImpl(LITERAL_EXPR)(6,9)
          GoTemplateLiteralImpl(LITERAL)(6,9)
            PsiElement(IDENTIFIER)('and')(6,9)
        PsiWhiteSpace(' ')(9,10)
        GoTemplateParenthesesExprImpl(PARENTHESES_EXPR)(10,94)
          PsiElement(()('(')(10,11)
          GoTemplateSimplePipelineImpl(SIMPLE_PIPELINE)(11,93)
            GoTemplateLiteralExprImpl(LITERAL_EXPR)(11,13)
              GoTemplateLiteralImpl(LITERAL)(11,13)
                PsiElement(IDENTIFIER)('or')(11,13)
            PsiWhiteSpace(' ')(13,14)
            GoTemplateParenthesesExprImpl(PARENTHESES_EXPR)(14,49)
              PsiElement(()('(')(14,15)
              GoTemplateSimplePipelineImpl(SIMPLE_PIPELINE)(15,48)
                GoTemplateLiteralExprImpl(LITERAL_EXPR)(15,23)
                  GoTemplateLiteralImpl(LITERAL)(15,23)
                    PsiElement(IDENTIFIER)('contains')(15,23)
                PsiWhiteSpace(' ')(23,24)
                GoTemplateFieldChainExprImpl(FIELD_CHAIN_EXPR)(24,40)
                  GoTemplateVariableExprImpl(VARIABLE_EXPR)(24,31)
                    PsiElement(VARIABLE)('$server')(24,31)
                  PsiElement(.)('.')(31,32)
                  PsiElement(IDENTIFIER)('Hostname')(32,40)
                PsiWhiteSpace(' ')(40,41)
                GoTemplateLiteralExprImpl(LITERAL_EXPR)(41,48)
                  GoTemplateLiteralImpl(LITERAL)(41,48)
                    GoTemplateStringLiteralImpl(STRING_LITERAL)(41,48)
                      PsiElement(STRING)('"cloud"')(41,48)
              PsiElement())(')')(48,49)
            PsiWhiteSpace(' ')(49,50)
            GoTemplateParenthesesExprImpl(PARENTHESES_EXPR)(50,93)
              PsiElement(()('(')(50,51)
              GoTemplateSimplePipelineImpl(SIMPLE_PIPELINE)(51,92)
                GoTemplateLiteralExprImpl(LITERAL_EXPR)(51,59)
                  GoTemplateLiteralImpl(LITERAL)(51,59)
                    PsiElement(IDENTIFIER)('contains')(51,59)
                PsiWhiteSpace(' ')(59,60)
                GoTemplateFieldChainExprImpl(FIELD_CHAIN_EXPR)(60,76)
                  GoTemplateVariableExprImpl(VARIABLE_EXPR)(60,67)
                    PsiElement(VARIABLE)('$server')(60,67)
                  PsiElement(.)('.')(67,68)
                  PsiElement(IDENTIFIER)('Hostname')(68,76)
                PsiWhiteSpace(' ')(76,77)
                GoTemplateLiteralExprImpl(LITERAL_EXPR)(77,92)
                  GoTemplateLiteralImpl(LITERAL)(77,92)
                    GoTemplateStringLiteralImpl(STRING_LITERAL)(77,92)
                      PsiElement(STRING)('"elegantthemes"')(77,92)
              PsiElement())(')')(92,93)
          PsiElement())(')')(93,94)
        PsiWhiteSpace(' ')(94,95)
        GoTemplateParenthesesExprImpl(PARENTHESES_EXPR)(95,119)
          PsiElement(()('(')(95,96)
          GoTemplateSimplePipelineImpl(SIMPLE_PIPELINE)(96,118)
            GoTemplateLiteralExprImpl(LITERAL_EXPR)(96,105)
              GoTemplateLiteralImpl(LITERAL)(96,105)
                PsiElement(IDENTIFIER)('hasSuffix')(96,105)
            PsiWhiteSpace(' ')(105,106)
            GoTemplateVariableExprImpl(VARIABLE_EXPR)(106,111)
              PsiElement(VARIABLE)('$path')(106,111)
            PsiWhiteSpace(' ')(111,112)
            GoTemplateLiteralExprImpl(LITERAL_EXPR)(112,118)
              GoTemplateLiteralImpl(LITERAL)(112,118)
                GoTemplateStringLiteralImpl(STRING_LITERAL)(112,118)
                  PsiElement(RAW_STRING)('`"^/"`')(112,118)
          PsiElement())(')')(118,119)
      PsiWhiteSpace(' ')(119,120)
      PsiElement(}})('}}')(120,122)
      GoTemplateStatementListImpl(STATEMENT_LIST)(122,122)
        <empty list>
      PsiErrorElement:TEXT or '{{' expected(122,122)
        <empty list>
HtmlFile:Dummy.gohtml(0,122)
  PsiElement(HTML_DOCUMENT)(0,0)
    PsiElement(XML_PROLOG)(0,0)
      <empty list>
  PsiElement(GoTemplateFragmentElementType)('{{ if and (or (contains $server.Hostname "cloud") (contains $server.Hostname "elegantthemes")) (hasSuffix $path `"^/"`) }}')(0,122)
izhangzhihao commented 4 years ago

But it's still not got highlighted yet...

izhangzhihao commented 3 years ago

image

image

izhangzhihao commented 3 years ago

Please SUPPORT US if you like this plugin.

You can download the latest snapshot build from here, just click the latest build and click the 'Artifacts' tab.(You need logged in via github) After the snapshot build downloaded, just drag the zip file into your IDE and done.