LanguageClient-neovim icon indicating copy to clipboard operation
LanguageClient-neovim copied to clipboard

Workspace root is incorrect (KotlinLanguageServer)

Open vito-c opened this issue 6 years ago • 2 comments
trafficstars

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.

vito-c avatar Mar 22 '19 18:03 vito-c

There are two ways you can customize the project root path,

  1. If launching manually, you can use something like :LanguageClientStart rootPath=/Users/...
  2. 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.

autozimu avatar Mar 26 '19 04:03 autozimu

I will prepare a PR. :)

vito-c avatar Mar 26 '19 22:03 vito-c