kotlin-language-server icon indicating copy to clipboard operation
kotlin-language-server copied to clipboard

Detection of generated code

Open SRechenberger opened this issue 5 years ago • 3 comments

Given the following example

import kotlinx.serialization.Serializable

@Serializable
data class X(val a: Int)

val foo = X.serializer()

VS Code can not resolve the reference serializer, although the compiler can build it without problems. I guess the problem is, that the method is generated at compile time, and does not exists, as the language server needs to know of it.

SRechenberger avatar Jun 18 '19 05:06 SRechenberger

+1 Maybe there is option to set to target generated classes for lsp?

belenot avatar Sep 11 '20 04:09 belenot

@SRechenberger @belenot Did you ever find a workaround to get the language server to work with generated sources?

cc: @rckgomz

carlospaulino avatar Oct 14 '22 02:10 carlospaulino

Yeah I can get it to work with everything, but the generated classes. Some tools like Netflix Dsg (for graphql) among others generate the java classes under target and they are invisible to the LSP There is an option to specify jars, but not classes to include. Ideally it should detect target folder automatically? I'm not well versed in java/kotlin, but seems to be a convention

danielfigueiredo avatar Mar 22 '24 16:03 danielfigueiredo