I defined the mod utils. but when i refrenence it, I got an error saying it could not find

I defined the mod utils. but when i refrenence it, I got an error saying it could not find.

Such that:

However. the syntax has already prompted the mod functional annotations. and it runs without any problems.

I aslo checked whether the key conflicts and it's no.

did you add pub keyword? please post the code where you define the mod.

The most likely suspect here is that you declare mod rs_env, but don't mark it as pub. (Or you don't declare the submodule at all)

Also, please don't post screenshots of VS Code-mangled error messages. Run cargo check in the terminal and post the full error message, inside code blocks like this:

```plain
Error message gets pasted here
```

(Note that screenshots in general are inaccessible to people with screen readers, impossible to copy-paste from, and have to be viewed with whatever viewing settings you, the poster, use. Paste code into code blocks, which I described above except instead of using plain, use rust to get Rust syntax highlighting)

fn main() {
    println!("This code has colors!");
}

Yes. I defined it in utils package and add it with cargo add.

/// 环境变量模块
///
/// 定义了变量结构体、查询方法
pub mod rs_env;
/// 文件处理模块
///
/// 定义了文件上传、下载、压缩方法
///
pub mod rs_fs;

the code runs without problem. but the vscode editor prompts an error

Ok. Thanks! I got it.

I don't get something error runs commnad cargo check. I used pub defined the mod. and my code runs fine. only vscode editor prompts an error.

the error info is:

failed to resolve: could not find `rs_env` in `utils`
could not find `rs_env` in `utils`rustc[Click for full compiler diagnostic](rust-analyzer-diagnostics-view:/diagnostic message [0]?0#file:///Users/admin/giteeCode/rsup/packages/pkg/src/package/package_json.rs)

utils

pub mod rs_env

Thank you!

maybe the files are out of sync. are you using rust-analyzer? in the status bar, there should be a rust-analyzer button or icon, try "reload workspace" or "restart lsp server".

Yes. I used vscode plugin rust-analyzer.

I have tried the button reload workspace or restart server. but it still happens

You don't add your own local code with cargo add (normally), I suspect you installed and are using this old crate: utils 0.0.3 - Docs.rs

I used cargo workspace option. the local utils package is instaled.

I checked Cargo.toml file is right.

[dependencies]
utils = { version = "0.1.0", path = "../utils" }

My code runs without errors. only vscode prompts

Yeah, that looks good, my apologies!

Hmm.. if you give it a different package name (eg the declared name and the dependency key in both Cargo.tomls) does that fix it? I'm thinking it might be that VS Code has this public crate cached somehow...