Complete for imported java class
Works well for the method in the same project

But if import com.github.pagehelper.PageHelper, then I want to complete method for PageHelper, works well in IDEA, but not popup in coc-java

This is IDEA

Could be the language server failed to load your .env file or it's getting too slow to response.
@chemzqm Not sure where is the problem, and VS Code works well for 3rd party lib, see this issue https://github.com/eclipse/eclipse.jdt.ls/issues/967
I still have this problem even setup env var for Gradle
It works as expected for me, try checkout output from language server https://github.com/neoclide/coc.nvim/wiki/Debug-language-server#using-output-channel
I found one error about invalid path [Error - 9:50:38 AM] 2019-9-17 9:50:38 Initialization failed Failed to scan D:\emp org.eclipse.core.runtime.CoreException: Failed to scan D:\emp
The correct path should be D:\Work\emp
@chemzqm the same project but got diff rootPath, I think this is the problem
WSL:
"rootPath": "/mnt/d/Work/ops",
"rootUri": "file:///mnt/d/Work/ops",
Windows:
"rootPath": "d:\\Work\\ops\\src\\main\\java\\com\\xxx\\ops\\controller",
"rootUri": "file:///d%3A/Work/ops/src/main/java/com/xxx/ops/controller",
Unlike vscode-java, coc-java doesn't have support for wsl.
@chemzqm But WSL works well, Windows got invalid root path
If I use gvim open project on Windows, the messages like this:
D:\Work\ops "src\main\java\com\xxx\controller\BlockIpController.java" [unix] 60L, 2198C [coc.nvim] Using java from d:\Program Files\Java\jdk1.8.0_161, version: 8 [coc.nvim] JDT Language Server starting at ops [coc.nvim] JDT Language Server error Failed to scan D:\ops
Seems the JDT not work on the right workspace, that cause complete not works well
If chdir to project folder in vim, still got JDT Language Server error Failed to scan D:\ops
Finally, I solved this problem by these steps:
- use teminal chdir to project folder, open gvim
- open source files then JDT can scan for whole project correctly, then can complete for 3rd party class
The problem is I cannot use chdir in vim, otherwise will cause JDT scan failed error, so the rootPath detect mechanism and JDT parameter should be improved to support open project directly in vim when I need to change current workspace
Use command:
java.project.addToSourcePath.command: Add Folder to Java Source Path: adds the selected folder to its project source path.
The workspace root resolve issue should be fixed on coc.nvim.