commit | 010683bdd3de7494538e9b489482f56c8487cca8 | [log] [tgz] |
---|---|---|
author | Matt Stark <msta@google.com> | Fri Apr 14 04:43:37 2023 |
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | Thu Apr 27 02:56:08 2023 |
tree | 6f66fcb3e8e7467d4b27bee6eb8258c96ff373a6 | |
parent | 5293edfe416ead42dc940651db4280d92aa04af7 [diff] |
Support live feedback for vscode rust code. BUG=b:277996109 TEST=manually verify vscode can parse things. Change-Id: Ie8fcd40c352c2beefe8474b9f756fa69206a95ff Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/rules_cros/+/4422573 Tested-by: Matt Stark <msta@google.com> Reviewed-by: Tim Bain <tbain@google.com> Commit-Queue: Matt Stark <msta@google.com>
This repository provides common rules and configuration for Bazel projects in Chrome OS.
The code is this directory is experimental and under active development. Stability and functionality is not guaranteed :)
We use rust_analyzer to generate a rust-project.json
file in the workspace root, which allows vscode to understand your dependencies.
Simply install the rust_analyzer VSCode plugin, and then add the following to your .vscode/tasks.json
file, substituting TARGET for a label of any bazel target you want to depend on. VSCode will then analyze all the transitive dependencies of the specified targets.
For example, I might use the following line:
"args": ["run", "//rules_cros/toolchains/rust:gen_rust_project", "--", "//rules_cros/toolchains/rust/examples/use_local_crate/...", "//rules_cros/toolchains/rust/examples/hello_world:helllo_world"],
{ "version": "2.0.0", "tasks": [ { "label": "Generate rust-project.json", "command": "bazel", "args": ["run", "//rules_cros/toolchains/rust:gen_rust_project", "--", "<TARGET1>", "<TARGET2>", "..."], "options": { "cwd": "${workspaceFolder}" }, "group": "build", "problemMatcher": [], "presentation": { "reveal": "never", "panel": "dedicated", }, "runOptions": { "runOn": "folderOpen" } }, ] }
If you add a new file, you may need to manually re-run the task.