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

Syntax highlighting is not working with comment #338

Closed
Munodi opened this issue Oct 21, 2017 · 9 comments
Closed

Syntax highlighting is not working with comment #338

Munodi opened this issue Oct 21, 2017 · 9 comments

Comments

@Munodi
Copy link

Munodi commented Oct 21, 2017

Normally a comment would be grey-greened out but I've discovered an instance where it is not.

Environment
  • Operating System: Windows 10 64 bit
  • JDK version: 9
  • Visual Studio Code version: 1.17.1
  • Java extension version: 0.12.0
Steps To Reproduce
  1. Create a class and add the code below to it.
  2. See that the comment is not highlighted correctly like it is in GitHub.
private JPanel plottingSurface = new JPanel() /* {
        @Override
        public Dimension getPreferredSize() {
            return new Dimension(400, 300);
        }
        @Override
        protected void paintComponent(Graphics g) {
            super.paintComponent(g);
        }
    }*/;
Current Result

not syntax-highlighted

Expected Result

Comment between first and last line coloured correctly

Additional Informations

Interestingly adding a semicolon before the comment colours the comment as expected

@fbricon
Copy link
Collaborator

fbricon commented Oct 22, 2017

Syntax highlighting is provided by the Textmate bundle embedded in vscode. Usually that kind of syntax highlighting problem is caused by a bug in the upstream Textmate bundle, but here, the issue can not be reproduced in Textmate, so this looks like a bug in vscode itself. Can you please open a report in https://github.com/Microsoft/vscode/issues?

cc @aeschli

@snjeza
Copy link
Contributor

snjeza commented Oct 22, 2017

I have converted the latest Textmate - https://github.com/textmate/java.tmbundle. It works fine.

java.tmLanguage.json

@snjeza
Copy link
Contributor

snjeza commented Oct 22, 2017

syntax

@fbricon
Copy link
Collaborator

fbricon commented Oct 22, 2017

@snjeza Please open a PR to vscode-java and link it here

@snjeza
Copy link
Contributor

snjeza commented Oct 22, 2017

syntax1

@fbricon
Copy link
Collaborator

fbricon commented Feb 1, 2018

With the vscode 1.19.3 (probably earlier versions too), highlighting is better, but there are still some issues with comments in the middle of a variable declaration:
screen shot 2018-02-01 at 12 33 41 pm

@Eskibear
Copy link
Contributor

Eskibear commented Nov 21, 2019

Screen Shot 2019-11-21 at 3 23 28 PM

Version: 1.41.0-insider
Commit: fe03510f9e9fb269ca35da0ea600dd95279fa2b7
Date: 2019-11-18T05:25:58.947Z
Electron: 6.1.4
Chrome: 76.0.3809.146
Node.js: 12.4.0
V8: 7.6.303.31-electron.0
OS: Darwin x64 17.7.0

Looks good now.

@Vigilans
Copy link
Contributor

There are still some issues with comment.

Screen Shot 2019-11-21 at 3 23 28 PM

It is owing to the massive usage of look around assertions in java's textmate grammar.

@fbricon
Copy link
Collaborator

fbricon commented Apr 27, 2020

This is partially fixed with the new semantic highlighting support in vscode-java 0.61.0. Requires "java.semanticHighlighting.enabled": true in settings.json. Without semantic highlighting, the Textmate grammar is still broken.

@fbricon fbricon closed this as completed Apr 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants