diff --git a/.vscode/settings.json b/.vscode/settings.json index 47cb954..43bde9e 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -103,4 +103,9 @@ ], "python.testing.unittestEnabled": false, "python.testing.pytestEnabled": true, + + // Enforce Bazel configuration for rust-analyzer (ignore Cargo) + "rust-analyzer.linkedProjects": [ + "rust-project.json" + ] } diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..6947297 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,12 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Update rust-analyzer config", + "type": "shell", + "command": "bazel run @rules_rust//tools/rust_analyzer:gen_rust_project", + "problemMatcher": [], + "group": "build" + } + ] +} diff --git a/README.md b/README.md index 42a32fc..76ac3ee 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,17 @@ bazel run //examples/rust/mini-adas:adas_primary [bazelisk]: https://github.com/bazelbuild/bazelisk +## IDE Setup (rust-analyzer) + +Because this project relies exclusively on **Bazel** for Rust, you must generate a `rust-project.json` file for `rust-analyzer` to provide features like code completion and go-to-definition. + +Generate the configuration by running: +```sh +bazel run @rules_rust//tools/rust_analyzer:gen_rust_project +``` + +*Note: If you use VS Code, a build task is included. You can press `Ctrl+Shift+B` (or `Cmd+Shift+B`) and select **Update rust-analyzer config** to regenerate this file anytime you add or modify dependencies in your `BUILD.bazel` files.* + ## Profiling ### CPU