-
Notifications
You must be signed in to change notification settings - Fork 233
Description
I have a Kotlin project where all dependencies are listed in build.gradle.kts and managed by Gradle. I use this language server with the Kotlin VS Code extension to work on the project. The server works fine most of the time, but external dependencies constantly cause issues. Sometimes, I clone a project from a remote repository, and all dependencies are resolved correctly. Then, I add a dependency to build.gradle.kts, build the project via the terminal, and this dependency is not resolved even after restarting the language server. Sometimes, I clean the ~/.gradle/caches directory, rebuild the project, and the dependency gets resolved correctly. Other times, it does not. Sometimes, I add a dependency to a perfectly fine project, and suddenly all other dependencies downloaded via Gradle cannot be resolved, including the Kotlin standard library. Occasionally, I add a dependency, and it resolves without any issues. I can't find any pattern in this, and it drives me insane.
I've tried cleaning the downloaded jars, clearing the VS Code workspace cache, building the project with Gradle or IntelliJ IDEA before opening it in VS Code, moving the project to another directory, simply waiting for the language server to catch up, running the language server with different JDK versions, and even trying different versions and forks - none of this seems to yield consistent results.
I use the latest versions of the language server and VS Code extension, I run Linux, and I have Java and Kotlin installed via SDKMAN. Gradle binaries are downloaded using the gradlew script. Since everything sometimes works, I assume this method of installation is acceptable. I can provide logs if needed, but there are rarely any errors or warnings, except for the occasional InvocationTargetException
thrown from org.eclipse.lsp4j.jsonrpc.RemoteEndpoint handleNotification
, which doesn't seem to correlate with my issues. In the logs, I also see that the server searches for dependencies for my project and successfully resolves them or fetches them from the cache, even if they are not actually resolved.
Just after I finished writing this issue, I reopened one of my Kotlin projects, and the language server just resolved everything. I haven't done anything since I last closed my project. It just worked. Please help.