Comments (15)
@DonnieWest I have created a Roadmap to track planned additions and new features. :)
from kotlin-language-server.
Changing the classpath is possible and would require tweaking of classpath/findClassPath.kt.
Unfortunately I do not know very much about Android applications, but usually classpath dependencies would instead be resolved through Gradle (or Maven) somehow.
from kotlin-language-server.
@fwcd I've tried updating the Gradle task to return the necessary .class
files from the build directory, but it's like the LSP server can't see the completions still. An example for this project I'm working on is in ProjectDir/app/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/package/name/R.class
I'm guessing that the classpath for the LSP can't contain compiled class files but must contain jars?
from kotlin-language-server.
@DonnieWest The java
command does accept both compiled class files and jar archives on the classpath, so I would have expected it to work. This seems strange...
from kotlin-language-server.
I'm definitely adding the necessary class files to the Gradle output. I'll create a rough PR when I get back to my computer to demonstrate the issue
If you also know of any good resources to help contribute more here, I'd love to have them :-)
from kotlin-language-server.
Sorry for how long it took me to get back to this.
You can see an example of Gradle adding .class files to the outputted classpath here DonnieWest@4b65e27
Still not sure why I'm not getting proper completions off from the class files
from kotlin-language-server.
I managed to get KotlinLanguageServer working in neovim + ale for Android projects. I had to change a lot the code to get this working (See attached diff).
I removed the dependency resolvers based on eclipse, Kotlin DSL and idea projects since these always seemed to succeed but returned no dependencies at all. This caused the last GradleCLI resolver to never execute.
My changes are based on my vim-android plugin.
diff --git a/src/main/kotlin/org/javacs/kt/classpath/gradleDependencyResolver.kt b/src/main/kotlin/org/javacs/kt/classpath/gradleDependencyResolver.kt
index cc21d2d..f3aca10 100644
--- a/src/main/kotlin/org/javacs/kt/classpath/gradleDependencyResolver.kt
+++ b/src/main/kotlin/org/javacs/kt/classpath/gradleDependencyResolver.kt
@@ -9,13 +9,7 @@ import java.io.File
import java.nio.file.FileSystems
import java.nio.file.Files
import java.nio.file.Path
-import java.nio.file.Paths
-import java.util.regex.Pattern
-import org.gradle.tooling.*
-import org.gradle.tooling.model.*
-import org.gradle.tooling.model.eclipse.*
-import org.gradle.tooling.model.idea.*
-import org.gradle.kotlin.dsl.tooling.models.*
+import org.gradle.tooling.GradleConnector
fun readBuildGradle(buildFile: Path): Set<Path> {
val projectDirectory = buildFile.getParent()
@@ -26,10 +20,6 @@ fun readBuildGradle(buildFile: Path): Set<Path> {
// The first successful dependency resolver is used
// (evaluating them from top to bottom)
var dependencies = firstNonNull<Set<Path>>(
- { tryResolving("dependencies using Gradle task") { readDependenciesViaTask(projectDirectory) } },
- { tryResolving("dependencies using Eclipse project model") { readDependenciesViaEclipseProject(connection) } },
- { tryResolving("dependencies using Kotlin DSL model") { readDependenciesViaKotlinDSL(connection) } },
- { tryResolving("dependencies using IDEA model") { readDependenciesViaIdeaProject(connection) } },
{ tryResolving("dependencies using Gradle dependencies CLI") { readDependenciesViaGradleCLI(projectDirectory) } }
).orEmpty()
@@ -42,20 +32,17 @@ fun readBuildGradle(buildFile: Path): Set<Path> {
}
private fun createTemporaryGradleFile(): File {
- val temp = File.createTempFile("tempGradle", ".config")
val config = File.createTempFile("classpath", ".gradle")
+ LOG.info("Creating temporary gradle file ${config.absolutePath}")
+
config.bufferedWriter().use { configWriter ->
ClassLoader.getSystemResourceAsStream("classpathFinder.gradle").bufferedReader().use { configReader ->
configReader.copyTo(configWriter)
}
}
- temp.bufferedWriter().use {
- it.write("rootProject { apply from: '${config.absolutePath.replace("\\", "\\\\")}'} ")
- }
-
- return temp
+ return config
}
private fun getGradleCommand(workspace: Path): Path {
@@ -67,101 +54,27 @@ private fun getGradleCommand(workspace: Path): Path {
}
}
-val jarArtifactOutputLine by lazy { Pattern.compile("^.+?\\.jar$") }
-
-private fun readDependenciesViaTask(directory: Path): Set<Path>? {
- val gradle = getGradleCommand(directory)
- val config = createTemporaryGradleFile()
-
- val gradleCommand = "$gradle -I ${config.absolutePath} classpath"
- val classpathCommand = Runtime.getRuntime().exec(gradleCommand, null, directory.toFile())
- val stdout = classpathCommand.inputStream
- val dependencies = mutableSetOf<Path>()
-
- stdout.bufferedReader().use { reader ->
- reader.lines().forEach {
- val line = it.toString().trim()
- if (!line.startsWith("Download") && jarArtifactOutputLine.matcher(line).matches()) {
- dependencies.add(Paths.get(line))
- }
- }
- }
-
- classpathCommand.waitFor()
-
- if (dependencies.size > 0) {
- return dependencies
- } else {
- return null
- }
-}
-
-private fun readDependenciesViaEclipseProject(connection: ProjectConnection): Set<Path> {
- val dependencies = mutableSetOf<Path>()
- val project: EclipseProject = connection.getModel(EclipseProject::class.java)
-
- for (dependency in project.classpath) {
- dependencies.add(dependency.file.toPath())
- }
-
- return dependencies
-}
-
-private fun readDependenciesViaIdeaProject(connection: ProjectConnection): Set<Path> {
- val dependencies = mutableSetOf<Path>()
- val project: IdeaProject = connection.getModel(IdeaProject::class.java)
-
- for (child in project.children) {
- for (dependency in child.dependencies) {
- if (dependency is ExternalDependency) {
- dependencies.add(dependency.file.toPath())
- }
- }
- }
-
- return dependencies
-}
-
-private fun readDependenciesViaKotlinDSL(connection: ProjectConnection): Set<Path> {
- val project: KotlinBuildScriptModel = connection.getModel(KotlinBuildScriptModel::class.java)
- return project.classPath.map { it.toPath() }.toSet()
-}
-
private fun readDependenciesViaGradleCLI(projectDirectory: Path): Set<Path>? {
LOG.fine("Attempting dependency resolution through CLI...")
+ val config = createTemporaryGradleFile()
val gradle = getGradleCommand(projectDirectory)
- val classpathCommand = "$gradle dependencies --configuration=compileClasspath --console=plain"
- val testClasspathCommand = "$gradle dependencies --configuration=testCompileClasspath --console=plain"
- val dependencies = findGradleCLIDependencies(classpathCommand, projectDirectory)
- val testDependencies = findGradleCLIDependencies(testClasspathCommand, projectDirectory)
-
- return dependencies?.union(testDependencies.orEmpty()).orEmpty()
+ val cmd = "$gradle -I ${config.absolutePath} kotlinLSPDeps --console=plain"
+ LOG.fine(" -- executing $cmd")
+ val dependencies = findGradleCLIDependencies(cmd, projectDirectory)
+ return dependencies
}
private fun findGradleCLIDependencies(command: String, projectDirectory: Path): Set<Path>? {
- return parseGradleCLIDependencies(execAndReadStdout(command, projectDirectory))
+ val result = execAndReadStdout(command, projectDirectory)
+ LOG.fine(result)
+ return parseGradleCLIDependencies(result)
}
-private val artifactPattern by lazy { "[\\S]+:[\\S]+:[\\S]+( -> )*([\\d.]+)*".toRegex() }
-private val jarMatcher by lazy { FileSystems.getDefault().getPathMatcher("glob:**.jar") }
+private val artifactPattern by lazy { "kotlin-lsp-gradle (.+)\n".toRegex() }
private fun parseGradleCLIDependencies(output: String): Set<Path>? {
val artifacts = artifactPattern.findAll(output)
- .map { findGradleArtifact(parseArtifact(it.value, it.groups[2]?.value)) }
+ .mapNotNull { FileSystems.getDefault().getPath(it.groups[1]?.value) }
.filterNotNull()
return artifacts.toSet()
}
-
-private fun findGradleArtifact(artifact: Artifact): Path? {
- val jarPath = gradleCaches
- ?.resolve(artifact.group)
- ?.resolve(artifact.artifact)
- ?.resolve(artifact.version)
- ?.let { dependencyFolder ->
- Files.walk(dependencyFolder)
- .filter { jarMatcher.matches(it) }
- .findFirst()
- }
- ?.orElse(null)
- return jarPath
-}
diff --git a/src/main/resources/classpathFinder.gradle b/src/main/resources/classpathFinder.gradle
index 2bf3fde..76d760b 100644
--- a/src/main/resources/classpathFinder.gradle
+++ b/src/main/resources/classpathFinder.gradle
@@ -1,83 +1,66 @@
-boolean isResolvable(Configuration conf) {
- // isCanBeResolved was added in Gradle 3.3. Previously, all configurations were resolvable
- if (Configuration.class.declaredMethods.any { it.name == 'isCanBeResolved' }) {
- return conf.canBeResolved
- }
- return true
-}
+allprojects { project ->
-File getBuildCacheForDependency(File dependency) {
- String name = dependency.getName()
- String home = System.getProperty("user.home")
- String gradleCache = home + File.separator + '.gradle' + File.separator + 'caches' + File.separator
- if (file(gradleCache).exists()) {
- String include = 'transforms*' + File.separator + '**' + File.separator + name + File.separator + '**' + File.separator + 'classes.jar'
- return fileTree(dir: gradleCache, include: include).files.find { it.isFile() }
- } else {
- return zipTree(dependency).files.find { it.isFile() && it.name.endsWith('jar') }
- }
-}
+ task kotlinLSPDeps {
+ task -> doLast {
+ System.out.println ""
+ System.out.println "gradle-version " + gradleVersion
+ System.out.println "kotlin-lsp-project " + project.name
+
+ if(project.hasProperty('android')) {
+
+ def rootDir = project.rootDir
-task classpath {
- doLast {
- HashSet<String> classpathFiles = new HashSet<String>()
- for (proj in allprojects) {
- for (conf in proj.configurations) {
- if (isResolvable(conf)) {
- for (dependency in conf) {
- classpathFiles += dependency
- }
- }
- }
+ def level = "21"
+ if(project.android.defaultConfig.targetSdkVersion != null) {
+ level = project.android.defaultConfig.targetSdkVersion.getApiLevel()
+ System.out.println "kotlin-lsp-target android-" + level
+ }
- def rjava = proj.getBuildDir().absolutePath + File.separator + "intermediates" + File.separator + "classes" + File.separator + "debug"
- def rFiles = new File(rjava)
- if (rFiles.exists()) {
- classpathFiles += rFiles
- }
+ def localProperties = new File(rootDir, "local.properties")
- if (proj.hasProperty("android")) {
- classpathFiles += proj.android.getBootClasspath()
- if (proj.android.hasProperty("applicationVariants")) {
- proj.android.applicationVariants.all { v ->
- if (v.hasProperty("javaCompile")) {
- classpathFiles += v.javaCompile.classpath
- }
- if (v.hasProperty("compileConfiguration")) {
- v.compileConfiguration.each { dependency ->
- classpathFiles += dependency
- }
- }
- if (v.hasProperty("runtimeConfiguration")) {
- v.runtimeConfiguration.each { dependency ->
- classpathFiles += dependency
- }
- }
- if (v.hasProperty("getApkLibraries")) {
- println v.getApkLibraries()
- classpathFiles += v.getApkLibraries()
- }
- if (v.hasProperty("getCompileLibraries")) {
- classpathFiles += v.getCompileLibraries()
- }
- }
- }
+ if (localProperties.exists()) {
+ Properties properties = new Properties()
+ localProperties.withInputStream { instr -> properties.load(instr) }
+ def sdkDir = properties.getProperty('sdk.dir')
+ def androidJarPath = sdkDir + "/platforms/android-" + level + "/android.jar"
+ System.out.println "kotlin-lsp-gradle " + androidJarPath
+ }
- if (proj.android.hasProperty("libraryVariants")) {
- proj.android.libraryVariants.all { v ->
- classpathFiles += v.javaCompile.classpath.files
- }
- }
- }
+ if(project.android.hasProperty('applicationVariants')) {
+ project.android.applicationVariants.all { variant ->
+ variant.getCompileClasspath().each {
+ System.out.println "kotlin-lsp-gradle " + it
+ }
+ }
+ }
- HashSet<String> computedPaths = new HashSet<String>()
- for (dependency in classpathFiles) {
- if (dependency.name.endsWith("jar")) {
- println dependency
- } else if (dependency != null) {
- println getBuildCacheForDependency(dependency)
- }
- }
- }
- }
+ def buildClasses = project.getBuildDir().absolutePath + File.separator + "intermediates" + File.separator + "classes" + File.separator + "debug"
+ System.out.println "kotlin-lsp-gradle " + buildClasses
+
+ } else {
+ // Print the list of all dependencies jar files.
+ project.configurations.findAll {
+ it.metaClass.respondsTo(it, "isCanBeResolved") ? it.isCanBeResolved() : false
+ }.each {
+ it.resolve().each {
+ if(it.inspect().endsWith("jar")) {
+ System.out.println "kotlin-lsp-gradle " + it
+ } else if(it.inspect().endsWith("aar")) {
+ // If the dependency is an AAR file we try to determine the location
+ // of the classes.jar file in the exploded aar folder.
+ def splitted = it.inspect().split("/")
+ def namespace = splitted[-5]
+ def name = splitted[-4]
+ def version = splitted[-3]
+ def explodedPath = "$project.buildDir/intermediates/exploded-aar" +
+ "/$namespace/$name/$version/jars/classes.jar"
+ System.out.println "kotlin-lsp-gradle " + explodedPath
+ }
+ }
+ }
+ }
+ }
+ }
}
+
+
from kotlin-language-server.
@hsanson Thanks for the fix. 👍
@DonnieWest Please reopen this issue or a new one if the problem persists.
from kotlin-language-server.
@fwcd looks like I can't reopen, but the problem persists
@hsanson are you able to complete R.* based layouts in your Android projects with this? If so, I'm probably doing something wrong on my end :P
Edit: Goodness, this is MUCH faster than my solution though
from kotlin-language-server.
@DonnieWest Ok, I will leave this issue open for now
from kotlin-language-server.
@DonnieWest in my setup it seems to work ok, see screen below:
My vim configuration maybe hint you on the issue:
https://github.com/hsanson/dotvim
The ALE + KotlinLanguageServer configuration is at the bottom. I recently added it so there may be things that can be improved.
Also I must mention that I am using deoplete plugin for auto-completion and that it actually takes some time before the completions are available.
from kotlin-language-server.
Hrm, till not getting proper completions. I used your init.vim in it's entirety and tried on an existing project and a fresh project from Android studio. I'll look into doing something a bit more minimally replicable
from kotlin-language-server.
@DonnieWest sorry to hear is not working for you. I create a simple HelloKotlin project directly using AndroidStudio that contains a single activity and auto-completion works perfectly for me for all classes, including R.
You can try running the custom gradle task used to extract dependencies:
./gradlew -I /home/source/KotlinLanguageServer/src/main/resources/classpathFinder.gradle kotlinLSPDeps
> Task :kotlinLSPDeps
gradle-version 4.4
kotlin-lsp-project HelloKotlin
> Task :app:kotlinLSPDeps
gradle-version 4.4
kotlin-lsp-project app
kotlin-lsp-gradle /home/ryujin/Apps/android-sdk/platforms/android-27/android.jar
kotlin-lsp-gradle /home/ryujin/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jre7/1.2.51/fa510f846ca4894fdf26776dd64cefb4030dcd12/kotlin-stdlib-jre7-1.2.51.jar
kotlin-lsp-gradle /home/ryujin/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.1.aar/0a13e945f0139a887a9fd4e7e19f823e/jars/classes.jar
kotlin-lsp-gradle /home/ryujin/.gradle/caches/transforms-1/files-1.1/constraint-layout-1.1.2.aar/693a19b6abc78520e38bedb07250a972/jars/classes.jar
kotlin-lsp-gradle /home/ryujin/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.2.51/fa8127e505bff50fec291d0dd619d1bda5c619e0/kotlin-stdlib-1.2.51.jar
kotlin-lsp-gradle /home/ryujin/.gradle/caches/transforms-1/files-1.1/support-fragment-27.1.1.aar/051973336d5bb3a627b2aabb7ad0f434/jars/classes.jar
kotlin-lsp-gradle /home/ryujin/.gradle/caches/transforms-1/files-1.1/animated-vector-drawable-27.1.1.aar/98cdf5b9f431b14f789f26cfa4b1f353/jars/classes.jar
kotlin-lsp-gradle /home/ryujin/.gradle/caches/transforms-1/files-1.1/support-core-ui-27.1.1.aar/9e0ddd1719d3ffd34ae6ae7c713fc2b1/jars/classes.jar
kotlin-lsp-gradle /home/ryujin/.gradle/caches/transforms-1/files-1.1/support-core-utils-27.1.1.aar/b97c448f797619bb902818be8908ed7e/jars/classes.jar
kotlin-lsp-gradle /home/ryujin/.gradle/caches/transforms-1/files-1.1/support-vector-drawable-27.1.1.aar/1ea9318a951d137dc8a998999254860d/jars/classes.jar
kotlin-lsp-gradle /home/ryujin/.gradle/caches/transforms-1/files-1.1/support-compat-27.1.1.aar/a28ff22f71c81f28f4c18406283667b6/jars/classes.jar
kotlin-lsp-gradle /home/ryujin/.gradle/caches/modules-2/files-2.1/com.android.support/support-annotations/27.1.1/39ded76b5e1ce1c5b2688e1d25cdc20ecee32007/support-annotations-27.1.1.jar
kotlin-lsp-gradle /home/ryujin/.gradle/caches/modules-2/files-2.1/com.android.support.constraint/constraint-layout-solver/1.1.2/bfc967828daffc35ba01c9ee204d98b664930a0f/constraint-layout-solver-1.1.2.jar
kotlin-lsp-gradle /home/ryujin/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.2.51/e4a9d4b13ab19ed1e6531fce6df98e8cfa7f7301/kotlin-stdlib-common-1.2.51.jar
kotlin-lsp-gradle /home/ryujin/.gradle/caches/modules-2/files-2.1/org.jetbrains/annotations/13.0/919f0dfe192fb4e063e7dacadee7f8bb9a2672a9/annotations-13.0.jar
kotlin-lsp-gradle /home/ryujin/.gradle/caches/transforms-1/files-1.1/livedata-core-1.1.0.aar/8f4dc1570631b565c467edcc438be939/jars/classes.jar
kotlin-lsp-gradle /home/ryujin/.gradle/caches/transforms-1/files-1.1/viewmodel-1.1.0.aar/b720f0486ecf4e1ab2555f2ba790c417/jars/classes.jar
kotlin-lsp-gradle /home/ryujin/.gradle/caches/transforms-1/files-1.1/runtime-1.1.0.aar/43cc47832badb6ac647f5e40ac4d5548/jars/classes.jar
kotlin-lsp-gradle /home/ryujin/.gradle/caches/modules-2/files-2.1/android.arch.lifecycle/common/1.1.0/edf3f7bfb84a7521d0599efa3b0113a0ee90f85/common-1.1.0.jar
kotlin-lsp-gradle /home/ryujin/.gradle/caches/transforms-1/files-1.1/runtime-1.1.0.aar/31555c45fba5d989bc32a18a8a17b224/jars/classes.jar
kotlin-lsp-gradle /home/ryujin/.gradle/caches/modules-2/files-2.1/android.arch.core/common/1.1.0/8007981f7d7540d89cd18471b8e5dcd2b4f99167/common-1.1.0.jar
kotlin-lsp-gradle /home/ryujin/Projects/HelloKotlin/app/build/tmp/kotlin-classes/debug
kotlin-lsp-gradle /home/ryujin/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jre7/1.2.51/fa510f846ca4894fdf26776dd64cefb4030dcd12/kotlin-stdlib-jre7-1.2.51.jar
kotlin-lsp-gradle /home/ryujin/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.1.aar/0a13e945f0139a887a9fd4e7e19f823e/jars/classes.jar
kotlin-lsp-gradle /home/ryujin/.gradle/caches/transforms-1/files-1.1/constraint-layout-1.1.2.aar/693a19b6abc78520e38bedb07250a972/jars/classes.jar
kotlin-lsp-gradle /home/ryujin/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.2.51/fa8127e505bff50fec291d0dd619d1bda5c619e0/kotlin-stdlib-1.2.51.jar
kotlin-lsp-gradle /home/ryujin/.gradle/caches/transforms-1/files-1.1/support-fragment-27.1.1.aar/051973336d5bb3a627b2aabb7ad0f434/jars/classes.jar
kotlin-lsp-gradle /home/ryujin/.gradle/caches/transforms-1/files-1.1/animated-vector-drawable-27.1.1.aar/98cdf5b9f431b14f789f26cfa4b1f353/jars/classes.jar
kotlin-lsp-gradle /home/ryujin/.gradle/caches/transforms-1/files-1.1/support-core-ui-27.1.1.aar/9e0ddd1719d3ffd34ae6ae7c713fc2b1/jars/classes.jar
kotlin-lsp-gradle /home/ryujin/.gradle/caches/transforms-1/files-1.1/support-core-utils-27.1.1.aar/b97c448f797619bb902818be8908ed7e/jars/classes.jar
kotlin-lsp-gradle /home/ryujin/.gradle/caches/transforms-1/files-1.1/support-vector-drawable-27.1.1.aar/1ea9318a951d137dc8a998999254860d/jars/classes.jar
kotlin-lsp-gradle /home/ryujin/.gradle/caches/transforms-1/files-1.1/support-compat-27.1.1.aar/a28ff22f71c81f28f4c18406283667b6/jars/classes.jar
kotlin-lsp-gradle /home/ryujin/.gradle/caches/modules-2/files-2.1/com.android.support/support-annotations/27.1.1/39ded76b5e1ce1c5b2688e1d25cdc20ecee32007/support-annotations-27.1.1.jar
kotlin-lsp-gradle /home/ryujin/.gradle/caches/modules-2/files-2.1/com.android.support.constraint/constraint-layout-solver/1.1.2/bfc967828daffc35ba01c9ee204d98b664930a0f/constraint-layout-solver-1.1.2.jar
kotlin-lsp-gradle /home/ryujin/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.2.51/e4a9d4b13ab19ed1e6531fce6df98e8cfa7f7301/kotlin-stdlib-common-1.2.51.jar
kotlin-lsp-gradle /home/ryujin/.gradle/caches/modules-2/files-2.1/org.jetbrains/annotations/13.0/919f0dfe192fb4e063e7dacadee7f8bb9a2672a9/annotations-13.0.jar
kotlin-lsp-gradle /home/ryujin/.gradle/caches/transforms-1/files-1.1/livedata-core-1.1.0.aar/8f4dc1570631b565c467edcc438be939/jars/classes.jar
kotlin-lsp-gradle /home/ryujin/.gradle/caches/transforms-1/files-1.1/viewmodel-1.1.0.aar/b720f0486ecf4e1ab2555f2ba790c417/jars/classes.jar
kotlin-lsp-gradle /home/ryujin/.gradle/caches/transforms-1/files-1.1/runtime-1.1.0.aar/43cc47832badb6ac647f5e40ac4d5548/jars/classes.jar
kotlin-lsp-gradle /home/ryujin/.gradle/caches/modules-2/files-2.1/android.arch.lifecycle/common/1.1.0/edf3f7bfb84a7521d0599efa3b0113a0ee90f85/common-1.1.0.jar
kotlin-lsp-gradle /home/ryujin/.gradle/caches/transforms-1/files-1.1/runtime-1.1.0.aar/31555c45fba5d989bc32a18a8a17b224/jars/classes.jar
kotlin-lsp-gradle /home/ryujin/.gradle/caches/modules-2/files-2.1/android.arch.core/common/1.1.0/8007981f7d7540d89cd18471b8e5dcd2b4f99167/common-1.1.0.jar
kotlin-lsp-gradle /home/ryujin/Projects/HelloKotlin/app/build/tmp/kotlin-classes/release
kotlin-lsp-gradle /home/ryujin/Projects/HelloKotlin/app/build/intermediates/classes/debug
This is the path were the R.class file is located on my environment:
kotlin-lsp-gradle /home/ryujin/Projects/HelloKotlin/app/build/intermediates/classes/debug
Maybe on your environment the R.class file is located on a different place?
Also this seems to have issues with Java 9/10 so all my system is configured to use Java 8.
from kotlin-language-server.
@DonnieWest found that if you build has flavors other than the "debug" and "release" defaults, then the intermediate class dependencies are not loaded.
Check #40 to see if this fixes your issue.
from kotlin-language-server.
@hsanson while #40 definitely helps support more variants, it wasn't actually my issue. I'm running a bit more bleeding edge on my Android Studio and Gradle plugins so my R.class files are found in a different folder. #44 should fix that for everyone
Thanks for bearing with me everyone :)
from kotlin-language-server.
Related Issues (20)
- Investigate whether we should move the grammar back to the `vscode-kotlin` repository
- Add auto-labeling GitHub Actions workflow for PRs
- macos version not support method textDocument/inlayHint. HOT 4
- Inconsistent Semantic Tokens
- Server initialization failed. HOT 1
- Extend "Add missing import" code action to suggest "static methods"/functions
- C interoperability support? HOT 3
- Crash on windows
- Automatically generate "thank you" message for all contributors in release script
- Dependency module <dependencies of main> was not initialized by the time contents of dependent module <dependencies of main> were queried HOT 1
- Add code completion for labels
- JsonSyntaxException on startup HOT 7
- Re-add semantic tokens for string literals without covering up interpolations
- Support java 21 HOT 1
- Despite best efforts a sea of red in vscode: MISSING_BUILT_IN_DECLARATION HOT 1
- language server won`t start after update gradle from 8.5 to 8.6 HOT 2
- Neovim + Android + Mason: Unresolved references for certain android dependencies
- Support for multi-module project HOT 4
- Extension fails on Ubuntu devcontainer - couldn't create connection to server. HOT 3
- java.util.concurrent.TimeoutException: Unable to connect language server
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kotlin-language-server.