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 broken on import containing upper cased letters #351

Closed
fbricon opened this issue Oct 31, 2017 · 12 comments
Closed

Syntax highlighting broken on import containing upper cased letters #351

fbricon opened this issue Oct 31, 2017 · 12 comments

Comments

@fbricon
Copy link
Collaborator

fbricon commented Oct 31, 2017

Try creating a java file with a package declaration containing upper cased letters, such as :
package org.gradle.apiImpl

Capital letters have a different colour:
screen shot 2017-10-31 at 4 10 54 pm

@fbricon
Copy link
Collaborator Author

fbricon commented Oct 31, 2017

Looks like a textmate bundle issue, though the same thing looks good in textmate itself. Maybe caused by a stale bundle in upstream vscode, although I tested with the latest Insiders build supposedly embedding a newer bundle.

@snjeza can you check please?

@snjeza
Copy link
Contributor

snjeza commented Oct 31, 2017

It works properly with microsoft/vscode#36708

@snjeza
Copy link
Contributor

snjeza commented Nov 1, 2017

@fbricon I have created the branch - https://github.com/snjeza/vscode-java/tree/textmate that overrides the VS Code Java syntax highlighting and uses the original textmate syntax highlighting - https://github.com/textmate/java.tmbundle.

@fbricon
Copy link
Collaborator Author

fbricon commented May 14, 2018

@snjeza any chance you can fix the upstream bundle instead? https://github.com/atom/language-java/blob/master/grammars/java.cson

@snjeza
Copy link
Contributor

snjeza commented May 14, 2018

@fbricon Will try.

@snjeza
Copy link
Contributor

snjeza commented May 28, 2018

See atom/language-java#141 and atom/language-java#140

You can test the PR using the https://github.com/snjeza/vscode-java/tree/issue-351 branch.

@fbricon
Copy link
Collaborator Author

fbricon commented May 31, 2018

@snjeza will vscode be able to override the atom settings, as described in atom/language-java#140 (comment)?

@snjeza
Copy link
Contributor

snjeza commented Jun 1, 2018

I suppose it can't be used in VS Code because VS Code uses json.
cc @aeschli

@aeschli
Copy link
Collaborator

aeschli commented Jun 1, 2018

If I understand this right, the Atom Java grammar emits scope invalid.deprecated.package_name_not_lowercase.java when it sees an uppercase package.
It's up to the color theme to decide what color to give this. Probably all theme's give everything that starts with invalid the red color.

You either have to convince all theme authors to set that scope to the regular package color or you can tell users to do that themselves in the 'editor.colorCustomizations` setting:

    "editor.tokenColorCustomizations": {
        "textMateRules": [
            {
                "scope": "invalid.deprecated.package_name_not_lowercase.java",
                "settings": {
                    "foreground": "#d4d4d4"
                }
            }
        ]
    },

Obvisouly that's not cool as #d4d4d4 depends on your color theme.

So either we live with it or we switch to a different grammar.

@aeschli
Copy link
Collaborator

aeschli commented Jun 1, 2018

I'm happy to switch to a different grammar if you recommend me one. It can be of any format (json,cson,tmLanguage,pList)...

@snjeza
Copy link
Contributor

snjeza commented Jun 1, 2018

@aeschli Could you just remove lines

,
{
        "match": "[A-Z]+",
        "name": "invalid.deprecated.package_name_not_lowercase.java"
}

in ./extensions/java/syntaxes/java.tmLanguage.json
Neither Eclipse nor IntelliJ IDEA highlights it.

@fbricon
Copy link
Collaborator Author

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

3 participants