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 Basic Auto Completion #971

Merged
merged 5 commits into from
Sep 6, 2021
Merged

Conversation

CsCherrYY
Copy link
Collaborator

@CsCherrYY CsCherrYY commented Sep 2, 2021

Parts of #956
completion

This PR try to get local gradle library file via the current vscode-java settings, and parse the gradle library file to get the content.

For method calls, we'll calculate call the method calls from the root to the inner calls, and use "org.gradle.api.Project" to match them one by one, for the final calls, we get the related Gradle Library and offer the completion results.

@CsCherrYY CsCherrYY added the enhancement New feature or request label Sep 2, 2021
@CsCherrYY CsCherrYY added this to the 3.8.0 milestone Sep 2, 2021
@CsCherrYY CsCherrYY mentioned this pull request Sep 2, 2021
7 tasks
@Eskibear
Copy link
Member

Eskibear commented Sep 2, 2021

in the screenshot above, when selecting gradleApi(), why it just inserts "gradleApi" without parenthesis?

@CsCherrYY
Copy link
Collaborator Author

in the screenshot above, when selecting gradleApi(), why it just inserts "gradleApi" without parenthesis?

It's a bug. Just try in IntelliJ and find it's behavior:

  • for those methods have only one method and it's arugment is groovy.lang.Closure, offers snippet {}
  • otherwise, offers ()

I'd like to change to this in the next commit.

@@ -16,6 +16,7 @@ dependencies {
implementation "org.eclipse.lsp4j:org.eclipse.lsp4j.jsonrpc:0.12.0"
implementation "org.codehaus.groovy:groovy-eclipse-batch:3.0.8-01"
implementation "com.google.code.gson:gson:2.8.7"
implementation "org.apache.bcel:bcel:6.5.0"
Copy link
Member

Choose a reason for hiding this comment

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

if it's shipped together, you should update thirdpartynotice

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

should we update the thirdpartynotice for other dependencies?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, we'd better do that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

track in #976

@@ -42,4 +53,14 @@ public static String getStringBeforePosition(String text, Range range, Position
}
return text.substring(0, position.getCharacter() - start.getCharacter());
}

public static void applySetting(GradleServices services, Object settings) {
Copy link
Member

Choose a reason for hiding this comment

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

applySetting anything to do with LSP?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The setting values are converted from LSP Json objects. Maybe something like GradleServivesUtils is a better place for this method?

Copy link
Member

Choose a reason for hiding this comment

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

to me, LSPUtils should host utilities like converting between LSP objects and other data structures.

Copy link
Member

Choose a reason for hiding this comment

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

can it be a public member of class GradleServices?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

can it be a public member of class GradleServices?

Sure.

this.applySetting(this, settings);
}

public void applySetting(GradleServices services, Object settings) {
Copy link
Member

Choose a reason for hiding this comment

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

why do you need to pass a GradleService? Can it be public void applySetting(Object settings) ?

@CsCherrYY CsCherrYY merged commit 1447bfe into cs-authoring-branch Sep 6, 2021
@CsCherrYY CsCherrYY deleted the cs-completion branch September 6, 2021 02:36
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 24, 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