question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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:

Issues I have:

Overload resolution ambiguity

kmp

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

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

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?

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:3
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
themkatcommented, Aug 1, 2022

As I said, better don’t. To fully build the lib, you need to install Haskell, nix package manager, build GCC from source (which is a part of Nix build process), setup CMake and so on. It will take at least one day of your time. Would be better to get results with chat sample (since it’s multiplatform and have a small codebase, while simplex-chat is not multiplatform). But it’s your choice, of course.

Don’t underestimate how stubborn I can be πŸ˜‰ I ended up playing with the ktor chat example for now. I think I will soon have a working solution for resolving dependencies in kotlin multiplatfor projects, but it needs some more testing. The current solution I have implemented needs some tweaking to work, as it is far from perfect. Hope to get a PR done by this evening.

Maybe playing with Haskell and Nix will be interesting for you (as from the mathematics perspective) πŸ˜ƒ

Those are really fun to play with indeed πŸ™‚ I’ve been wanting to go through the How To Solve It book my George Polya, and solve it in Haskell. Heard from someone long ago that it was really fun to do so. There is too much fun stuff to do for me to have time for everything πŸ™

0reactions
aventlycommented, Jul 31, 2022

I cloned this repo (kotlin-language-server), opened nvim inside, got an error about missing maven, installed maven, reopened nvim, the project opened successfully. No errors, fast errors displaying after making some (right after living insert mode, even without delay). I was impressed.

Then I opened Keymapper project. I’m now much older than I was when did so. Project setup takes centuries. I stopped counting my age:) I mean, Indexing stage took more than an hour and still being indexing. Closed it, run ./gradlew assemble. Turns out I need to accept licenses as you are. Did it.

Now I got this error in lsp log file:

[WARN][2022-07-31 23:29:59] ...lsp/handlers.lua:456	"async0    Gradle task failed: \nFAILURE: Build failed with an exception.\n\n* Where:\nBuild file '/mnt/Dev/apps/keymapper/kotlin-language-server/server/src/test/resources/additionalWorkspace/build.gradle' line: 2\n\n* What went wrong:\nA problem occurred evaluating root project 'test-project'.\n> Could not get unknown property 'kotlinVersion' for object of type org.gradle.plugin.use.internal.PluginRequestCollector$PluginDependenciesSpecImpl.\n\n* Try:\n> Run with --stacktrace option to get the stack trace.\n> Run with --info or --debug option to get more log output.\n> Run with --scan to get full insights.\n\n* Get more help at https://help.gradle.org\n\nBUILD FAILED in 888ms"

First result in search is this: https://stackoverflow.com/questions/64834818/android-studio-could-not-get-unknown-property-kotlin-version

Results from this repo: https://github.com/fwcd/kotlin-language-server/search?q=kotlinVersion

Maybe after adapting language-server source code to suggestions from SO result will be better.

But at least it’s something new. Which means installing maven helped somehow.

Do you have a buffer like mine for Language server outputs? The errors I’m talking about is not shown as code errors, just in my lsp-log-buffer (or Kotlin-output section if using VSCode).

There are so many lines in the lsp log (more than 160000), almost all of them about Back-end (JVM) Internal error when I try to open my projects.

Regarding sample chat, the log starts with this:

ERROR][2022-07-31 23:48:29] .../vim/lsp/rpc.lua:420	"rpc"	"/home/dev/.local/share/nvim/lsp_servers/kotlin_language_server/server/bin/kotlin-language-server"	"stderr"	'SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".\nSLF4J: Defaulting to no-operation (NOP) logger implementation\nSLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.\n'
[ERROR][2022-07-31 23:49:16] ...lsp/handlers.lua:454	"org.jetbrains.kotlin.codegen.CompilationException: Back-end (JVM) Internal error: Failed to generate function testSimpleConversation\nFile being compiled: (13,5) in //mnt/Dev/apps/ktor-samples/chat/src/backendTest/kotlin/ChatApplicationTest.kt\nThe root cause java.lang.IllegalStateException was thrown at: org.jetbrains.kotlin.codegen.state.KotlinTypeMapper$typeMappingConfiguration$1.processErrorType(KotlinTypeMapper.kt:128)"
[

After that multiple errors related to different things. In nvim it’s still can’t find Kotlin.Unit and others.

one of the first ones you sent, simplex-chat

As I said, better don’t. To fully build the lib, you need to install Haskell, nix package manager, build GCC from source (which is a part of Nix build process), setup CMake and so on. It will take at least one day of your time. Would be better to get results with chat sample (since it’s multiplatform and have a small codebase, while simplex-chat is not multiplatform). But it’s your choice, of course. Maybe playing with Haskell and Nix will be interesting for you (as from the mathematics perspective) πŸ˜ƒ

Read more comments on GitHub >

github_iconTop Results From Across the Web

Kotlin throws false errors for everything in VS Code
I was using kotlin some time ago and everything worked fine (vscode version was 1.69.2 at the time). I tried again today after...
Read more >
neovim/neovim - Gitter
My clangd was giving that error but gcc compiled fine. mjlbach. @atrius:matrix.org. [Β ...
Read more >
friendly reminder for our vscode folks, use rust-analyzer - Reddit
I tried it just now by renaming the RLS rust-analyzer binary and uninstalling and installing the plugin. I am greeted with a 'bootstrap...
Read more >
What is your opinion for VIM vs VSCode? - Morioh
Performance : It delivers optimal performance. Cross-platform development: You can develop both Android and iOS apps with it. The reuse of code expeditesΒ ......
Read more >
Bug listing with status UNCONFIRMED as at 2022/12/19 21 ...
Terminal network speed test that uses servers from Speedtest.net" ... error: undefined reference to 'sqrt'" status:UNCONFIRMED resolution: severity:normalΒ ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found