-
Notifications
You must be signed in to change notification settings - Fork 55
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
Add support for subfolder gradle projects #1336
Conversation
When resolving wrapper consider the current gradle file path to resolve it.
@jdneo @testforstephen WDYT ? |
@gayanper I'll take a look recently. To help me understand the case that this PR fixes, could you share a screenshot showing the folder structure of the workspace we are talking about? |
If the language server failed to locate the correct wrapper, the fix should be applied in eclipse.jdt.ls as well. jdt.ls has its own logic for finding the gradle distribution. This repo vscode-repo is an independent project and does not interact with jdt.ls. |
jdt.ls works without issues. The reason might be the project import er traverse the folder structure to find gradle files recursively. And those found paths are used by gradle eclipse tooling to import projects into workspace. |
If i open the gradle-spring folder, the language server only provides the basic closures. But if i open the demo folder inside the gradle-spring then all plugin closures are provided. |
I tried to open workspace contains gradle project in a subfolder, but it does not give me completion for a gradle.mp4 |
@jdneo when this issues happens you won't get inbuilt gradle plugin completions even. For example java, test and also dependency and different dependency configuration completions. Could you try on those with and without fix on same setup? |
Not sure if it is due to something wrong with my local setup. I'll ask @CsCherrYY later. |
@jdneo hope the above screenshots makes it more clear |
@jdneo @testforstephen I would say if we support multi-root workspace folders, then we should try to fix this. I found few more such extension which doesn't work in the way i explained above. I think vscode expect to use multi-root workspace folders in such situations like this https://medium.com/rewrite-tech/visual-studio-code-tips-for-monorepo-development-with-multi-root-workspaces-and-extension-6b69420ecd12 |
We can close this if you also agree, The extension works as it is with multi-root workspaces. |
Yes, I agree. Today I tried to setup the project on another machine and now everything works as expected. Not sure what's wrong happened days ago... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, the change looks good to me. I found another problem when trying the change, but that's another problem which we can address in another PR in the future.
Update: There is already an issue tracking this problem. #1237
gradle-language-server/src/main/java/com/microsoft/gradle/resolver/GradleLibraryResolver.java
Outdated
Show resolved
Hide resolved
@gayanper I think this PR can be merged after the variable name changes. :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @gayanper
In the multi module setup where the parent folder is open by vscode, when wrapper is enabled, the LS fails the resolved the wrapper since it looks in workspace folder which is the root folder of the multi module project structure. The wrapper folders are actually in leaf level folders where the gradle files are found. So this fix try to resolve wrapper consider the current gradle file path to resolve it first, if that fails it falls back to workspace folder as before.