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

feat: Support semantic highlighting #967

Merged
merged 3 commits into from
Sep 1, 2021

Conversation

CsCherrYY
Copy link
Collaborator

@CsCherrYY CsCherrYY commented Aug 31, 2021

Parts of #956. Please note that basic syntax highlighting is in #960.

semantic

@CsCherrYY CsCherrYY added the enhancement New feature or request label Aug 31, 2021
@CsCherrYY CsCherrYY added this to the 3.8.0 milestone Aug 31, 2021
@CsCherrYY CsCherrYY mentioned this pull request Aug 31, 2021
7 tasks
@CsCherrYY CsCherrYY force-pushed the cs-semantic-highlighting branch from 25ea215 to 083fd60 Compare September 1, 2021 01:31
@CsCherrYY CsCherrYY marked this pull request as ready for review September 1, 2021 01:32
@@ -102,6 +109,8 @@ private void compile(URI uri, GradleCompilationUnit unit) {
Set<PublishDiagnosticsParams> diagnostics = new HashSet<>();
try {
unit.compile(Phases.CANONICALIZATION);
// If fatal error occurs and no AST generated, the visitCompilationUnit() will be ignored.
this.visitor.visitCompilationUnit(uri, unit);
Copy link
Member

Choose a reason for hiding this comment

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

this ASTVisitor is to calculate Semantic Tokens. but compile(uri, unit) is shared among other tasks. So, will there be unnecessary calculation here e.g. when processing 'textdocument/completion` requests?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We have stored the results in the ASTVisitor and get them via this.visitor.getXXX(). So if we support completion, we'll add some operations in the ASTVisitor and storage the completion related results. The approach is that we don't have to visit the AST more than once to the all the results. (for semantic highlighting, document symbol and completion)

If we separate the visitor for each usage, we might visit the AST more than once.


private String genericName;
// See https://docs.gradle.org/current/javadoc/org/gradle/api/Project.html
private static List<String> defaultLibrary = List.of("afterEvaluate", "allprojects", "ant", "apply", "artifacts",
Copy link
Member

Choose a reason for hiding this comment

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

is it necessary to assign individual modifier for every closure type? How do you assign textmate scopes/styles in downstream themes then?

@CsCherrYY CsCherrYY merged commit 360f0e7 into cs-authoring-branch Sep 1, 2021
@CsCherrYY CsCherrYY deleted the cs-semantic-highlighting branch September 1, 2021 04:57
CsCherrYY added a commit that referenced this pull request Sep 6, 2021
CsCherrYY added a commit that referenced this pull request Sep 23, 2021
CsCherrYY added a commit that referenced this pull request Sep 26, 2021
* feat: Initialize Language Server (#959)

* feat: Support compiling and pushing diagnostics (#962)

* feat: Support basic groovy syntax highlighting (#960)

* feat: Support semantic highlighting (#967)

* feat: Support document outline (#969)

* feat: Support auto completion in dependencies closure (#970)

* feat: Support Basic Auto Completion (#971)

* fix: Add null check for visitors (#974)

* feat: Show symbol detail for method calls (#973)

* chore: Prepare for 3.8.0 (#978)

* fix: Use padding to correct version order (#986)

* fix: Dependency completion doesn't work when multiple dependencies closures exist (#984)

* fix: Correct version completion kind (#985)

* fix: Handle multiple content changes (#992)

* feat: Support completion for settings.gradle (#988)

* fix: Offer completion results from supertypes (#987)

* feat: Provide dependencies content in outline (#998)

* feat: Support basic java plugin aware (#989)

* feat: Support basic tasks and dependencies (#1002)

* chore: Add thirdpartynotice

* chore: Fix ci
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants