-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Support For Annotations in Java #905
Conversation
desertjim
commented
Mar 5, 2016
- Adding annotation token
- Making the annotation token match before function
Hi @desertjim Thanks for contributing. Annotations are indeed missing in Java. Your PR contains a lot of minified files, that have nothing to do with Java annotations. What minifier did you use to create these? You either have to add the css class 'annotation': {
pattern: /(@{1}\w*\(.*?\))|(@{1}\w+)/i,
alias: 'regex'
} Isn't |
Hi @zeitgeist87 I was just using gulp. I thought it was minifying the js files. Here is what I did:
|
I am not sure if the colors you chose are such a good idea. They are very bright and prominent. My Eclipse standard theme for Java uses a more subtle grayish color for annotations. Intellij uses some kind of olive green. I am not sure how other IDEs and themes style annotations: We should probably use a color, that is more familiar to most Java developers. What do you think? Do you have a particular reason for choosing bright orange? The Prism.languages.insertBefore('groovy', 'function', {
'annotation': {
pattern: /(^|[^.])@\w+/,
lookbehind: true
}
}); Also you don't need the capturing groups and the case insensitive flag. This should be enough: |
I just installed gulp-uglify so I must be using a newer version. I do like the color choice, but my aim was to not end up having code directly adjacent to the annotations being the same color. So I just picked an existing color to make sure it was still in the same theme and went with it. To avoid bikeshedding I'll leave the color to whatever you suggest :). I can update the regex to match groovy, should I use the lookBehind: true also(sorry not familiar with this)? |
Well I am not really sure what the best choice is here. Here are a few examples:
public class Duck extends Base {
@Override
public void quack() {
System.out.println("Quack");
}
} I am open for suggestions, but in my opinion annotations should not stand out more than for example keywords.
Yes |
What about aliasing it to punctuation? Then it would look discreet in all themes. |
Yes let's do that. I think it looks nice. We can always change it later: @desertjim You could also add |
@zeitgeist87 should be good now |
Thanks! It looks good to me. You should also squash down all of your commits into a single commit. Otherwise we get all the back and forth into the PrismJS git log after the merge. |
2)Aliasing java annotation to punctuation 3)Aliasing grovy annotation to punctuation 4)Adding in sample code
ok, it's ready |
Support For Annotations in Java
Is this going to be released? |
We make releases periodically, but it's already in Prism. Everyone downloading Prism from the website can get it. :) |
I am installing this from NPM and it seems that it doesn't have this feature. Could you please make a release for it? |
We do not make releases for specific features, we release periodically. This will be in the next release, which will happen soon. |