Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generated types not visible to IntelliJ #1102

Open
cgruber opened this issue Jan 19, 2024 · 2 comments
Open

Generated types not visible to IntelliJ #1102

cgruber opened this issue Jan 19, 2024 · 2 comments
Assignees

Comments

@cgruber
Copy link
Collaborator

cgruber commented Jan 19, 2024

When running kotlin in IntelliJ, code that is generated in either ksp or kapt processors (e.g. dagger, or custom ksp) are not attached in a way that IJ can see them. They compile, but redline. This also has the effect of making the generated sources un-findable by the IDE.

Related: ksp-generated sources are not visible under bazel-out. kapt-generated sources are, under bazel-bin/path/to/library/_javac/lib/lib-java_tmp/path/to/library/GeneratedFile.java. .kt files generated by KSP are available in the deep directories, but not attached anywhere within bazel-out, so they can't even be navigated to from within the project.

While this is strictly an IntelliJ Bazel plugin issue, it seems to likely be an issue with various aspects and what info attached during rules_kotlin related actions. I'm not sure how to better describe this, but can dig into it with anyone, with examples.

@cgruber
Copy link
Collaborator Author

cgruber commented Jan 19, 2024

@restingbull is a comedian

@henrikpersson
Copy link

Adding something like this to the BUILD that uses the kt_ksp_plugin "fixed" it for me:

java_plugin(
    name = "convince_intellij_this_module_generates_code",
    srcs = ["Empty.java"],
    generates_api = True,
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants