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 compiling and pushing diagnostics #962

Merged
merged 3 commits into from
Aug 31, 2021

Conversation

CsCherrYY
Copy link
Collaborator

@CsCherrYY CsCherrYY commented Aug 31, 2021

Part of #956

diag

One concern here is to reconstruct a new CompilationUnit once the text changes. Currently I can't find a proper way to support reuse CompilationUnit by changing it's SourceUnit, and there is no API found. Just test an extreme case on a Gradle file with more than 1000+ lines, writing a Gradle Closure, and the compile time is acceptable.

Just search in GitHub and find the following results (Aug.31 2021):
example:
ev

result:
Constant condition: language:Gradle filename:build.gradle extension:gradle

Additional Condition Results Percentage
None 5333504 100%
Size > 100 5254537 98.5%
Size > 10000 54387 1.01%
Size > 35000 1380 0.0259%
Size > 50000 583 0.0109%

My test Gradle file has about 1000 lines and the size is about 35KB. So I think the result can cover most case of gradle files.

jp-1000
(This record is just a reference and recorded in my feature branch with semantic highlighting, completion and documentSymbol on, just to show the percentage of compiling)

@CsCherrYY CsCherrYY mentioned this pull request Aug 31, 2021
7 tasks
@CsCherrYY CsCherrYY added this to the 3.8.0 milestone Aug 31, 2021
@CsCherrYY CsCherrYY added the enhancement New feature or request label Aug 31, 2021
@CsCherrYY CsCherrYY requested a review from Eskibear August 31, 2021 08:30
@Eskibear
Copy link
Member

Eskibear commented Aug 31, 2021

Just test an extreme case on a Gradle file with more than 1000+ lines, writing a Gradle Closure, and the compile time is acceptable.

Size > 35000 1380 0.0259%

It looks fine based on your findings above. Besides CPU time, please also keep an eye on memory, and GC.

import org.eclipse.lsp4j.Position;
import org.eclipse.lsp4j.Range;

public class GradleUtils {
Copy link
Member

Choose a reason for hiding this comment

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

About the class name, suggest to move all conversion between LSP item and java element to something like "LSPUtils".

import org.eclipse.lsp4j.Range;

public class GradleUtils {
public static Range getExpressionLSPRange(SyntaxException exp) {
Copy link
Member

Choose a reason for hiding this comment

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

Range toRange(SyntaxException exp) should be simple and enough, if it's callled by LSPUtils.toRange(exp)

Copy link
Member

@Eskibear Eskibear left a comment

Choose a reason for hiding this comment

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

LGTM

@CsCherrYY CsCherrYY merged commit cf9fe93 into cs-authoring-branch Aug 31, 2021
@CsCherrYY CsCherrYY deleted the cs-diagnostics branch August 31, 2021 15:51
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