LanguageClient-neovim
LanguageClient-neovim copied to clipboard
Workspace root is incorrect (KotlinLanguageServer)
I am trying to use the KotlinLanguageServer but there are a lot of Unresolved references coming back because the Client is sending the incorrect workspace. Is there a way to force the workspace? Seems like this would be a pretty standard problem for jvm based languages since it's setting the directory the source is in as the root dir.
{
"jsonrpc": "2.0",
"method": "window/logMessage",
"params": {
"type": 3,
"message": "client Searching for dependencies in workspace root /Users/vito-c/code/kotlin-akka/src/main/kotlin/koala"
}
}
it should be /Users/vito-c/code/kotlin-akka/
https://github.com/fwcd/KotlinLanguageServer/issues/100#issuecomment-475691053
If you wanted to attempt to imply the root dir you could search for the git dir... https://github.com/vito-c/pirate-vim/blob/90457014a236c1a67d474a90979ba6ad8c8b2747/rc/git.vim#L11-L24 though it should still be configurable via an override.
There are two ways you can customize the project root path,
- If launching manually, you can use something like
:LanguageClientStart rootPath=/Users/... - https://github.com/autozimu/LanguageClient-neovim/blob/53ce2fee7d24dd9262ea783908e2edebc71635dc/doc/LanguageClient.txt#L249-L265
As a fallback, when root path cannot be queried from approaches above, this plugin uses a simple heuristic approach to determine root path, https://github.com/autozimu/LanguageClient-neovim/blob/53ce2fee7d24dd9262ea783908e2edebc71635dc/src/utils.rs#L44-L71
which definitely has flaws. I have no clue how your code is organized or how kotlin project should be organized. So please suggest if you can help with this heuristic approach.
I will prepare a PR. :)