Skip to content
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

Colorization of multiple dim arrays is broken #220

Closed
Portur opened this issue Apr 23, 2019 · 4 comments
Closed

Colorization of multiple dim arrays is broken #220

Portur opened this issue Apr 23, 2019 · 4 comments
Labels

Comments

@Portur
Copy link

Portur commented Apr 23, 2019

Colouring starts at wrong index.

From yellow to green as per default colours.
First should start at yellow then move down the range?

The example screenshot provides an example where the first bracket starts at green for some reason. Shouldn't all the brackets be yellow?

Your programming language(s)

Javascript

Expected Behavior

Each index of brackets should be from 0 to 5

Current Behavior

Each index of brackets start at the last index, 5 to 0

Possible Solution

.

Code snippet for reproduce (for bugs)

see screenshot

this[c] = this[c] || {};
this[c][an] = this[c][an] || {};
this[c][an][at] = this[c][an][at] || {};
this[c][an][at][k] = this[c][an][at][k] || {};
this[c][an][at][k][d] = this[c][an][at][k][d] || {};

image

Your Environment

  • Plugin version: 5.18
  • IDE & Operating System version, comment your env as below(go to "About IntelliJ IDEA" -> click the "copy" icon):

IntelliJ IDEA 2018.3.3 (Ultimate Edition)
Build #IU-183.5153.38, built on January 9, 2019
Licensed to -
Subscription is active until May 18, 2019
JRE: 1.8.0_152-release-1343-b26 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0

IntelliJ IDEA 2018.1 (Ultimate Edition)
Build #IU-181.4203.519, built on March 22, 2018
JRE: 1.8.0_152-release-1136-b20 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.13.3
@izhangzhihao
Copy link
Owner

Related to #174.

@izhangzhihao
Copy link
Owner

Both of if/else code blocks and multiple dim arrays are implemented by nested PSI tree.

js code:

this[c][an][at][k][d] = {};

PSI tree:

JSFile:Dummy.js(0,27)
  JSExpressionStatement(0,27)
    JSAssignmentExpression(0,26)
      JSDefinitionExpression:<anonymous>(0,21)
        JSIndexedPropertyAccessExpression(0,21)
          JSIndexedPropertyAccessExpression(0,18)
            JSIndexedPropertyAccessExpression(0,15)
              JSIndexedPropertyAccessExpression(0,11)
                JSIndexedPropertyAccessExpression(0,7)
                  JSThisExpression(0,4)
                    PsiElement(JS:THIS_KEYWORD)('this')(0,4)
                  PsiElement(JS:LBRACKET)('[')(4,5)
                  JSReferenceExpression(5,6)
                    PsiElement(JS:IDENTIFIER)('c')(5,6)
                  PsiElement(JS:RBRACKET)(']')(6,7)
                PsiElement(JS:LBRACKET)('[')(7,8)
                JSReferenceExpression(8,10)
                  PsiElement(JS:IDENTIFIER)('an')(8,10)
                PsiElement(JS:RBRACKET)(']')(10,11)
              PsiElement(JS:LBRACKET)('[')(11,12)
              JSReferenceExpression(12,14)
                PsiElement(JS:IDENTIFIER)('at')(12,14)
              PsiElement(JS:RBRACKET)(']')(14,15)
            PsiElement(JS:LBRACKET)('[')(15,16)
            JSReferenceExpression(16,17)
              PsiElement(JS:IDENTIFIER)('k')(16,17)
            PsiElement(JS:RBRACKET)(']')(17,18)
          PsiElement(JS:LBRACKET)('[')(18,19)
          JSReferenceExpression(19,20)
            PsiElement(JS:IDENTIFIER)('d')(19,20)
          PsiElement(JS:RBRACKET)(']')(20,21)
      PsiWhiteSpace(' ')(21,22)
      PsiElement(JS:EQ)('=')(22,23)
      PsiWhiteSpace(' ')(23,24)
      JSObjectLiteralExpression(24,26)
        PsiElement(JS:LBRACE)('{')(24,25)
        PsiElement(JS:RBRACE)('}')(25,26)
    PsiElement(JS:SEMICOLON)(';')(26,27)

@izhangzhihao
Copy link
Owner

Almost same situation of #174.

@izhangzhihao izhangzhihao changed the title Colouring starts at wrong index. First should start at yellow then move down the range? Colorization of multiple dim arrays is broken Jul 31, 2019
@izhangzhihao
Copy link
Owner

Close for duplicated with #174

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants