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

Update java highlight mode to support 21 version features #5343

Merged
merged 4 commits into from
Oct 16, 2023

Conversation

mkslanc
Copy link
Contributor

@mkslanc mkslanc commented Oct 6, 2023

Issue #, if available: #5338 #2742

Description of changes:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@codecov
Copy link

codecov bot commented Oct 6, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (7a6b83e) 87.41% compared to head (15f343f) 87.44%.
Report is 5 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5343      +/-   ##
==========================================
+ Coverage   87.41%   87.44%   +0.02%     
==========================================
  Files         574      575       +1     
  Lines       45613    45679      +66     
  Branches     6935     6939       +4     
==========================================
+ Hits        39873    39943      +70     
+ Misses       5740     5736       -4     
Flag Coverage Δ
unittests 87.44% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
src/mode/java_highlight_rules.js 100.00% <100.00%> (ø)

... and 5 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

"strings": [
{
token: "string",
regex: /(?:STR|FMT)\."/,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't correct. Technically the prefix can be any expression so long as it returns a TemplateProcessor

so

try (var conn = ds.getConnection()) {
   var stmt = conn."""
   SELECT * FROM table WHERE x = \{x}
   """;
}

or

a.b().c().e()."""
   Sub \{here}
"""

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, new approach should work. The only problem I see - is usage of outstanding ."""text""" without adding any processor, but for solving this case mode should recognize whole contexts and this would be a little bit too much.

@InspiredGuy InspiredGuy requested a review from bowbahdoe October 9, 2023 14:58
@bowbahdoe
Copy link

I see i was requested to review it - give me a minute to figure out how to test it locally...

@bowbahdoe
Copy link

bowbahdoe commented Oct 10, 2023

image

One strange thing is that record declarations seem to be seen as method calls? Thats fine for the param list, but its strange that one class name would be highlighted differently than another

@InspiredGuy
Copy link
Contributor

Hey @bowbahdoe thank you for the review! Would you consider the issue you highlighted above a deal breaker to merge this PR? I'm not a Java user myself so it's hard for me to evaluate the severity of the issue you pointed out above.

@mkslanc please take a look at the issue above, maybe fixing it would be faster than discussing it :)

@mkslanc
Copy link
Contributor Author

mkslanc commented Oct 11, 2023

@bowbahdoe @InspiredGuy This change should make it :)

@bowbahdoe
Copy link

@mkslanc I will take a look tonight

Copy link

@bowbahdoe bowbahdoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks good. Once there is a release, i'll update https://java-playground.com and if we find any more issues i'll report them

@InspiredGuy
Copy link
Contributor

Thank you @bowbahdoe , your help is appreciated!

@InspiredGuy InspiredGuy merged commit 25d86b6 into ajaxorg:master Oct 16, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants