Arnavion / k8s-openapi

Rust definitions of the resource types in the Kubernetes client API
Apache License 2.0
386 stars 41 forks source link

Types autocomplete and go-to-defenition are not working in IDEA Intellij #122

Closed testitm closed 2 years ago

testitm commented 2 years ago

Hey! Not an issue, but I'm having struggles with autocomplete and go-to-defenition when trying to access something like k8s_openapi::api::core::v1::Pod. IDE just can't find sources after ::api::. IDE - Intellij IDEA. Sorry to bother you, but I hope somebody had such experience and knows how to fix this.

Arnavion commented 2 years ago

So it can find api/mod.rs from ::api ? If so, then that means the version feature resolution at least is working correctly, ie it's not a situation like #52. So if it's able to get to api I can't think of anything obvious preventing it from finding core and onwards.

testitm commented 2 years ago

So, intellij-rust team helped me here: https://github.com/intellij-rust/intellij-rust/issues/9093 They have experimental feature that can fix this issue:

Try to enable org.rust.cargo.evaluate.build.scripts experimental feature and reload project model via Refresh Cargo Projects action in Cargo tool window to make it work as expected

and it works :)

Arnavion commented 2 years ago

Well, I'm not sure I understand their investigation.

As I can see, k8s_openapi crate has a build script that generates some code. Build script support is not enabled by default yet in the plugin. It may lead to such issues since the plugin doesn't know about some sources.

The only code generated by the build script is the k8s_openapi_* macros. It doesn't affect api::core.

But if enabling that option works for you, I'm not going to argue.