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

enh(java) support functions with nested template types #3074

Merged
merged 3 commits into from
Apr 6, 2021

Conversation

joshgoebel
Copy link
Member

@joshgoebel joshgoebel commented Mar 25, 2021

Resolves #2641.

Changes

Allows Java template types for functions to be recursive a single level:

IE (Token within List):

static Optional<List<Token>> parseAll(String s) {
}
  • also lints Java
  • also splits out literals and types from keywords

Checklist

  • Added markup tests, or they don't apply here because...
  • Updated the changelog at CHANGES.md

Copy link
Member

@allejo allejo left a comment

Choose a reason for hiding this comment

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

Does this PR intentionally only account for one level of nesting?

image

Otherwise, lgtm

src/languages/java.js Outdated Show resolved Hide resolved
* @returns {string}``
*/
function recurRegex(re, substitution, depth) {
if (depth === -1) return "";
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if (depth === -1) return "";
if (depth < 0) return "";

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think this is an improvement. I'd rather be precise.

@joshgoebel
Copy link
Member Author

Does this PR intentionally only account for one level of nesting?

It accounts for the examples I was given. If your example is common then we can bump the # slightly but there is no need for it to be higher than it should be. Bump it to 2?

@joshgoebel joshgoebel merged commit 2b9007e into highlightjs:main Apr 6, 2021
@joshwand
Copy link

joshwand commented Apr 6, 2021

Can’t speak for everyone but I see deeply nested types all the time in my work.

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.

(Java) Can't match nested generic type identifier
3 participants