fwcd / kotlin-language-server

Kotlin code completion, diagnostics and more for any editor/IDE using the Language Server Protocol
MIT License
1.58k stars 202 forks source link

Bump Kotlin to 2.0.0 #576

Open AlexandrosAlexiou opened 1 month ago

AlexandrosAlexiou commented 1 month ago
AlexandrosAlexiou commented 1 month ago

This PR is an attempt to bump the kotlin version to 2.0.0 and ultimately start making myself familiar with the codebase as I would be interested in supporting the project.

That being said, I am noticing an issue with theseAdditionalWorkspaceTest.kt and ClassPathTest.kt test class methods not passing right now, but I created the PR anyway to spark the discussion.

There seems to be an issue resolving junit in the classpath, so hovering over the assertTrue method returns null.

I packaged the server after the update and instantiated it from Neovim, and it seems that it works, but the hovering over assertTrue returns null.

Any thought or pointers on where to start looking to resolve this issue?

Tests output:

AdditionalWorkspaceTest > junit should be on classpath FAILED
    java.lang.AssertionError:
    Expected: a string containing "fun assertTrue"
         but: was "```kotlin
    null
    ```"
        at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
        at org.junit.Assert.assertThat(Assert.java:865)
        at org.junit.Assert.assertThat(Assert.java:832)
        at org.javacs.kt.AdditionalWorkspaceTest.junit should be on classpath(AdditionalWorkspaceTest.kt:31)

ClassPathTest > find gradle classpath FAILED
    java.lang.AssertionError:
    Expected: a collection containing a string containing "junit"
         but: was "ClassPathEntry(compiledJar=~/.m2/repository/org/jetbrains/kotlin/kotlin-stdlib/1.9.22/kotlin-stdlib-1.9.22.jar, sourceJar=null)"
        at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
        at org.junit.Assert.assertThat(Assert.java:865)
        at org.junit.Assert.assertThat(Assert.java:832)
        at org.javacs.kt.ClassPathTest.find gradle classpath(ClassPathTest.kt:28)
fwcd commented 1 month ago

Thanks for looking into this, very much appreciated! It would be nice if you could split out the refactorings/cleanups into smaller commits for easier reviewability.

Regarding the failing test, you could try running ./gradlew test with --info to get output. Looks like it can't find JUnit for some reason, a wild guess would be that you'd have to bump the Kotlin version in the test workspace too (under server/src/test/resources/additionalWorkspace)

AlexandrosAlexiou commented 1 month ago

Thanks for looking into this, very much appreciated! It would be nice if you could split out the refactorings/cleanups into smaller commits for easier reviewability.

Regarding the failing test, you could try running ./gradlew test with --info to get output. Looks like it can't find JUnit for some reason, a wild guess would be that you'd have to bump the Kotlin version in the test workspace too (under server/src/test/resources/additionalWorkspace)

Hey! Thanks for the reply. I do have bumped it here.

I removed all other changes for now that are not related with the version bump. I will continue taking a look why we cant find junit. Any help would be much appreciated!

AlexandrosAlexiou commented 1 month ago

Hello, turns out it was an issue that I still do not understand, but now all the tests are passing. Please check so that we can move forward with this MR.

Tested also in my Neovim setup:

Screenshot 2024-06-08 at 1 23 12 PM
AlexandrosAlexiou commented 1 month ago

@fwcd Sorry for pinging you, can you take a look when you have some time?