fwcd / fwcd/kotlin-language-server

coc + kotlin-language-server + nvim building former Android Studio Project

Open
#284 5 comments 1 reaction 0 assignees View on GitHub
bug dependency resolution
Dominant language
Kotlin
Stars
2k
Forks
252
PR merge metrics
No merged PRs in 30d

Description

(new to Kotlin, gradle, Android Apps, _etc_)

I got coc and kotlin-langugage-server working in Vim, but when I open my kotlin file every symbol is basically an error:
```
[kotlin MISSING_BUILT_IN_DECLARATION] [E] Cannot access built-in declaration 'kotlin.String'. Ensure that you have a dependency on the Kotlin standard library
```

This project works when I open it with Android Studio.

I've seen many similar reported issues, but the ones that were solved didn't look applicable.

My nvim is setup so that the work directory is the top of the git repo, my app is in `client/`, and it has a `gradlew` file. I've invoked `./gradlew androidDependencies` which did something successfully.

I have log files, I'm not sure how to interpret the messages, though this appears pertinent:
```
/tmp/kotlin-daemon.2021-03-23.09-25-02-144.00.log

2021-03-23 09:25:05.441 [daemon] INFO: Message: logging: using Kotlin home directory
2021-03-23 09:25:05.442 [daemon] INFO: Message: logging: scripting plugin will not be loaded: not all required jars are present in the classpath (missing files: [./kotlin-scripting-compiler.jar, ./kotlin-scripting-compiler-impl.jar, ./kotlinx-coroutines-core.jar, ./kotlin-scripting-common.jar, ./kotlin-scripting-jvm.jar, ./kotlin-scripting-js.jar, ./js.engines.jar])
```

I found `kotlin-scripting-compiler.jar`, and added its path to my `CLASSPATH` (tried `PATH` too) but this didn't help. I've even tried symlinking some of those files to a local path in an attempt to match the `./`, all to no avail.

How can I get the kotlin-language-server to find my dependencies?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the project layout in client/, the gradlew entry point, and the kotlin-language-server setup used by coc in Neovim. Read /tmp/kotlin-daemon.2021-03-23.09-25-02-144.00.log alongside the result of ./gradlew androidDependencies; done means Kotlin symbols and built-in declarations no longer appear as errors when the project is opened in Neovim.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin, neovim
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.