fwcd / fwcd/kotlin-language-server

[Multiplatform + Neovim + VSCode] Performance, unresolved references, errors

Open
#376 14 comments 10 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
2k
Forks
252
PR merge metrics
No merged PRs in 30d

Description

Hello, thank you for the work on this server. Trying to make it work with Neovim. I'm using Intellij IDEA maaaany years and the project I testing now works in IDEA beautifully. So I suppose I need to somehow setup the server if I want to use it with Neovim.
I filling this issue with multiple problems because I think that all issues related to one thing that I'm missing. If it's not the case, tell me to create multiple small issues or to read docs:)

Prerequests:
- Neovim 0.7.0
- Plugin https://github.com/neovim/nvim-lspconfig with Kotlin config: https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/kotlin_language_server.lua
- LSP installer in use: https://github.com/williamboman/nvim-lsp-installer/
- Archlinux x86_64
- 4 cores & 16 GB RAM (cloud)
- installed kotlin via `pacman -S kotlin`
- installed gradle with `pacman -S gradle`

Issues I have:

### Overload resolution ambiguity

![kmp](https://user-images.githubusercontent.com/7953703/181831638-c7d3cc8a-c9b7-4f13-b324-415fc3a2b083.png)

It's a main problem. The main thing for KMPP is not working properly. While `Goto reference` works perfectly within MY common/native/Android code. The server able to find reference to a function from different source set.

### Unresolved references

Third-party libraries don't work. While all of them work in Intellj IDEA.

![unresolved](https://user-images.githubusercontent.com/7953703/181832464-8e70c747-e0b1-4350-a3f9-b49c51fbbbb6.png)

### Low performance

After reopening vim (closing vim and reopening it again) on the same file I worked before it takes 4-8 minutes to see first error highlighting. All this time CPU almost on max. Memory usage increases from 1G to 4-5GB easily (numbers without including Gradle memory usage). Almost all CPU usage from the server, not Gradle.

When the server started (for the moment when I see highlighted errors), I try to edit something. So I just removing a piece of code to make the server showing an error. Error is not highlighted even after a couple of minutes. In IDEA it takes 2-3 seconds on a long file.

Screenshot after 3 minutes of loading the project:
![cpu-usage](https://user-images.githubusercontent.com/7953703/181831350-1948fb6f-2ab7-4d00-8a54-5d71c5b9544c.png)

Video about not highlighted error in a code after making an error:

https://user-images.githubusercontent.com/7953703/181840048-035db041-e1d4-471e-bff3-c42d0edab302.mp4

Project structure:
```
.
├── android
│ ├── build.gradle
│ └── src
│ ├── main
│ └── test
├── build.gradle
├── common
│ ├── build.gradle
│ └── src
│ ├── androidMain
│ ├── commonMain
│ ├── desktopMain
│ └── jvmMain
├── core
│ ├── build.gradle
│ ├── gradle
│ │ └── wrapper
│ ├── gradle.properties
│ ├── gradlew
│ ├── gradlew.bat
│ └── src
│ ├── commonMain
│ ├── commonTest
│ ├── jvmMain
│ └── nativeMain
├── desktop
│ ├── build.gradle.kts
│ └── src
│ └── jvmMain
├── gradle
│ └── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradle.properties
├── gradlew
├── gradlew.bat
├── local.properties
└── settings.gradle

```

settings.gradle
```
rootProject.name = 'MyProject'
include ':core'
include ':common'
include ':android'
include ':desktop'
```

## What am I doing wrong?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the nvim-lspconfig Kotlin server configuration and the provided settings.gradle, build.gradle, and multiplatform source-set layout. Reproduce the unresolved references, overload ambiguity, and delayed diagnostics using the listed Neovim setup, then determine whether each symptom has a separate cause. Done requires a confirmed resolution for the reported problems and comparable diagnostic behavior after editing.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin, neovim, vscode
Domain
developer-experience, devtools, performance
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.