AvinZarlez / processing-vscode

A Visual Studio Code extension for the programming language Processing
https://marketplace.visualstudio.com/items?itemName=Tobiah.language-pde
MIT License
177 stars 25 forks source link

Strings inside 'println()' highlighted not as expected in some cases #57

Closed ivanshuba closed 4 years ago

ivanshuba commented 5 years ago

Strings inside println() method highlighted not as expected in some cases

The issue appears for both println() and System.out.println() methods.

To Reproduce the issue Create a simple *.pde file with the following content:

void setup() {
  size(400, 400);
  println("This is a correct syntax highlight");
  if (10 = 10) { 
    println("This is a correct syntax highlight");
  }
  println("This is a INCORRECT syntax highlight");
}

then, to see even more different coloring behavior, change the content to the following

println("This is a INCORRECT syntax highlight");
if (10 = 10) { 
  println("This is a correct syntax highlight");
}
println("This is a INCORRECT syntax highlight");

Expected behavior Words are highlighted with varied colors which are different from the plain color used for highlighting the strings in other places. In my case, some words are purple and red instead of plain green.

Possible reason It seems that the behavior depends on the number of curly braces placed above the mentioned text.

Screenshots image image image

Desktop:

AvinZarlez commented 5 years ago

Interesting. I believe this is a problem with the pde.tmLanguage file.

Sadly, I didn't write that file. I borrowed it from the Processing Sublime plugin ( https://github.com/b-g/processing-sublime ) which hasn't been updated in a while.

I honestly don't have the time to dig into the pde.tmLanguage file and figure out what is going wrong to cause this. But if somebody does and makes a PR, I'd love to fix this.

atnbueno commented 4 years ago

The 10 = 10 is wrong ("The left-hand side of an assignment must be a variable"). The highlighting problem dissapears if you fix it: 10 == 10