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

Add the ability to highlight java primitives separately from keywords. #860

Closed

Conversation

mfarrugi
Copy link

Add the ability to highlight java primitives separately from keywords. This leaves the default highlighting unchanged (ie. the same as keywords).

image

The README.md doesn't cover running tests, so lmk if there's anything else I should do.

(CLA should be good from intellij-rust contributions)

@mfarrugi
Copy link
Author

@dyadix does this look it will be merged eventually?

@ignatov
Copy link
Contributor

ignatov commented Jul 23, 2019

@akozlova please assist.

@akozlova
Copy link
Contributor

Why do you want primitives to be highlighted differently from other keywords? The place under "classes and interfaces" is unexpected and I doubt that the highlighting would be used by many users.

Moreover, how would you highlight var? I guess, it would be inconsistent as in some cases it must be "primitive" and in others "non-primitive".

@akozlova akozlova added the Waiting for Reply The author needs to provide additional details requested by IntelliJ IDEA developers label Jul 25, 2019
@mfarrugi
Copy link
Author

Personally I wanted int and other primitive types to be the same color as classes in my color scheme. I don't know where else in the menus it would go, and I'm not attached to this particular placement.

Primitives are the keywords that are actual type names, whereas var is a non-type keyword. If we really wanted, var and any/every other (type of) keyword could be separately colorable as well (eg. visibility modifiers).

@akozlova
Copy link
Contributor

I believe that var is a type-keyword in java 10+, https://openjdk.java.net/jeps/286

Frankly saying I don't want to add a feature for the sake of adding a feature. I think, it's a good candidate to be implemented as a plugin, e.g. see how soft keywords are processed com.intellij.codeInsight.daemon.impl.JavaSoftKeywordHighlightingPassFactory

@mfarrugi
Copy link
Author

The implementation slots in very cleanly in a few lines of configuration here, I imagine as a plugin it takes substantially more code and maintenance to implement. I view this in the same vein as being able to highlight class/anonymous class/interface all separately if one chooses, just a little bit more customization.

I don't mean anything pedantic by type-keyword, just that int and long are named types while var is not.

@akozlova
Copy link
Contributor

I would be happy to accept the PR with the new API which would make writing the plugin to highlight different keywords easy.
I feel uncomfortable here because the next PR would ask to highlight boolean differently from int and long and then another one to separate float and double. This makes the settings to mess and complicates the configuration a lot. Thus I think it's better to achieve through the plugin. With good API I can imagine that the plugin could consist mostly from plugin.xml with registered keywords.

@mfarrugi
Copy link
Author

I'm not interested in making a plugin to avoid making a 7 line change.

@mfarrugi mfarrugi closed this Sep 24, 2020
SergeyZh pushed a commit that referenced this pull request Oct 9, 2020
)

* Consider navigation element in PSI equality checks

This seems to solve issues related to psi becoming outdated.
Extension of comment by ajchun:
mplushnikov/lombok-intellij-plugin#840 (comment)

Covers issues: #821, #827, #829, #840, #842, #844, #846, #850, #853, #854, #855, #857

* Remove debug logging related to equality of PsiElements

GitOrigin-RevId: e9ad9801b15dc91b872b14add012a9261033fbc7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Waiting for Reply The author needs to provide additional details requested by IntelliJ IDEA developers
Projects
None yet
4 participants