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

[modern-tree-sitter] Java Syntax Highlighting #896

Closed
5 tasks done
confused-Techie opened this issue Jan 28, 2024 · 2 comments · Fixed by #859
Closed
5 tasks done

[modern-tree-sitter] Java Syntax Highlighting #896

confused-Techie opened this issue Jan 28, 2024 · 2 comments · Fixed by #859
Labels
bug Something isn't working

Comments

@confused-Techie
Copy link
Member

Thanks in advance for your bug report!

  • Have you reproduced issue in safe mode?
  • Have you used the debugging guide to try to resolve the issue?
  • Have you checked our FAQs to make sure your question isn't answered there?
  • Have you checked to make sure your issue does not already exist?
  • Have you checked you are on the latest release of Pulsar?

What happened?

I've noticed what feels like a bug in Java Syntax Highlighting.

Which to be clear is way better in Java, although still seems to be missing something.

In the following snippet:

import java.util.Scanner;

public class balloon {
  public static void main(String[] args) {
    int initialDiameter;
    Scanner scnr = new Scanner(System.in);
    System.out.print("Input Initial Diameter: ");
    initialDiameter = scnr.nextInt();
    
    int diameter = initialDiameter;
    
    double v1 = Math.PI * initialDiameter * initialDiameter * initialDiameter / 6;

    diameter = diameter++;
    
  }
}

In this snippet the diameter = diameter++; only applies highlighting on the = with the rest being just basic text.

Additionally, the assignment of initialDiameter is blank, along with usage of initialDiameter later on, although thats less of an issue.

To be clear, non of this is a regression, in fact in the Legacy Tree-Sitter the situation is the same, except two things:

  • The ++ is highlighted, which is the only regression present.
  • All variable instantiating has no highlighting

So mostly things are better here, but still not perfect.

Would love if you could take a look!

Pulsar version

1.113.0

Which OS does this happen on?

🪟 Windows

OS details

2H22

Which CPU architecture are you running this on?

x86_64/AMD64

What steps are needed to reproduce this?

  1. Create file anthing.java
  2. Paste above code snippet in
  3. View the lack of highlighting

Additional Information:

No response

@confused-Techie confused-Techie added the bug Something isn't working label Jan 28, 2024
@savetheclocktower
Copy link
Contributor

Addressed in this commit. Should now scope variables whenever they're reassigned or incremented. Also added -- and ++ as operators.

@confused-Techie confused-Techie linked a pull request Jan 28, 2024 that will close this issue
@confused-Techie
Copy link
Member Author

Amazingly speedy @savetheclocktower, absolutely unbelievable, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants