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

Semantic Tokens ext point #1683

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

BoykoAlex
Copy link

Fixes #1594

Extension point to contribute semantic tokens into the JDT Java editor.

@BoykoAlex BoykoAlex changed the title Sync jdt syntax highlighting Semantic Tokens ext point Sep 28, 2024
@martinlippert
Copy link

martinlippert commented Oct 14, 2024

After the initial discussion in #1594, this is the corresponding PR with the implementation. Would be extremely awesome if someone could have a look and provide feedback, so that we can get this merged whenever it makes sense.

Interested @noopur2507, @iloveeclipse, @HannesWell ?

@HannesWell
Copy link
Contributor

After the initial discussion in #1594, this is the corresponding PR with the implementation. Would be extremely awesome if someone could have a look and provide feedback, so that we can get this merged whenever it makes sense.

Interested @noopur2507, @iloveeclipse, @HannesWell ?

Unfortunately I'm not a JDT committer and cannot say with certainty who would be the best person to review this.
Besides the other one you mentioned, maybe @mickaelistria can have a look since he also works on LS integration?

@mickaelistria
Copy link
Contributor

I'm not a committer on JDT either ( https://projects.eclipse.org/projects/eclipse.jdt/elections/election-mickael-istria-committer-eclipse-jdt-java-development-tools ). I've put some generic comments about documentation and API that needs to be polished.

<meta.schema plugin="org.eclipse.jdt.ui" id="semanticTokens" name="%semanticTokens"/>
</appInfo>
<documentation>
[Enter description of this extension point.]
Copy link
Contributor

Choose a reason for hiding this comment

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

This will need to be filled


import org.eclipse.jdt.core.dom.CompilationUnit;

public interface SemanticTokensProvider {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use ISemanticTokensProvider for consistency with other interfaces

@BoykoAlex
Copy link
Author

@mickaelistria @martinlippert updated the PR for Mickael's comments

@martinlippert
Copy link

@BoykoAlex Thanks for incorporating the comments from @mickaelistria (and thanks a lot @mickaelistria for taking a look, much appreciated).

Now looking for a JDT UI committer to pick this up and provide feedback, merge, or whatever makes sense to move this forward.

import java.util.Collection;

import org.eclipse.jdt.core.dom.CompilationUnit;

Copy link
Contributor

Choose a reason for hiding this comment

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

fix missing since

}

private Highlighting findHighlighting(String preferenceKey) {
for (int i = 0; i < fJobSemanticHighlightings.length; i++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

this codes looks like fJobSemanticHighlightings and fJobHighlightings needs to be of same size, which is documented no where. You may even better use a single Collection containing tuples to make that clear.


/**
* XXX Hack for performance reasons (should loop over fJobSemanticHighlightings can call consumes(*))
* @since 3.5
*/
private Highlighting fJobDeprecatedMemberHighlighting;

private Highlighting[] fEditorHighlightings;
Copy link
Contributor

Choose a reason for hiding this comment

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

does this duplicate a hack? better find a solution?

@jukzi
Copy link
Contributor

jukzi commented Oct 28, 2024

This change is rather complex to review, fails the automated tests and does not come with junit testcases.
At best the added API is tested with junit and used within jdt.ui itself or comes with a examples, so it will be actually tested by users. Please also add description how to systematically test including screenshots what to expect. If you have fixed all issues you may ping me for review. The merge may have to wait until an M1.

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 editor syntax highlighting via extension point
5 participants