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

Unresolved reference for auto generated code #10862

Open
benkeil opened this issue Sep 13, 2023 · 3 comments
Open

Unresolved reference for auto generated code #10862

benkeil opened this issue Sep 13, 2023 · 3 comments

Comments

@benkeil
Copy link

benkeil commented Sep 13, 2023

Environment

  • IntelliJ Rust plugin version: 0.4.200.5421-232
  • Rust toolchain version: stable-aarch64-apple-darwin rustc 1.68.2 (9eb3afe9e 2023-03-27)
  • IDE name and version: IntelliJ IDEA 2023.2.1 (Ultimate Edition)
  • Operating system: MacOS Ventura 13.5.2 (22G91)

Problem description

When using generated code, the IDE often does not find the struct. VS Code and Fleet don't have this problem.

Steps to reproduce

The CustomResource trait creates the struct AwsAccount:

use garde::Validate;
use kube::CustomResource;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

#[derive(CustomResource, Deserialize, Serialize, Clone, Debug, Validate, JsonSchema)]
#[kube(
    group = "platform.benkeil.de",
    version = "v1alpha1",
    kind = "AwsAccount",
    namespaced,
    shortname = "acc"
)]
#[kube(status = "AwsAccountStatus")]
#[serde(rename_all = "camelCase")]
pub struct AwsAccountSpec {
    #[garde(skip)]
    account_id: String,
    #[garde(skip)]
    team: String,
    #[garde(skip)]
    regions: Vec<String>,
}

#[derive(Deserialize, Serialize, Clone, Debug, Default, JsonSchema)]
pub struct AwsAccountStatus {
    provisioned: bool,
}

And the IDE says Unresolved reference: AwsAccount

@Maksim20023
Copy link
Collaborator

Hi! Thank you for reaching us.
Unfortunately, based on the description, I can't reproduce the issue. Please take a look at the screenshot and check if my way of reproducing is correct.

Screenshot

Screenshot 2023-09-13 at 10 42 41

As a general troubleshooting step, please try to perform Invalidate caches with the checked "Clear file system cache and Local History" option.

@benkeil
Copy link
Author

benkeil commented Sep 13, 2023

I tried to setup a new test repo but everything worked.

In the original repo I tried to invalidate caches, but no success.
Then I deleted the .idea folder and it works again.

@jagregory
Copy link

I've also been experiencing this issue with macros which generate code (like typify's import_types macro). I sometimes have to invalidate IntelliJ's caches otherwise the IDE won't find the updated types, despite the actual compile working fine.

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

No branches or pull requests

3 participants