https://www.rust-lang.org/tools/install指出可以使用 WSL 安装 Rust,效果很好。然而, VSCode 的 rust-analyzer 插件默认只能利用主机系统的 rust 安装,因为它在启动过程中找不到货物安装,并失败并显示以下消息:
[ERROR rust_analyzer::main_loop] FetchWorkspaceError:
rust-analyzer failed to load workspace: "cargo" "--version" failed: program not found
Run Code Online (Sandbox Code Playgroud)
有没有办法配置 rust-analyzer 以使用我的 WSL Rust 安装?
当然,另一种选择是使用开发容器,但这对于我正在从事的特定项目来说会非常麻烦。
我是 javascript 新手。我有一个问题,但我不知道它可能是什么。我应该将我的 javascript 链接到我的 html。有三个按钮可以在点击时将文本变成不同的颜色。但它不起作用。
// this is the red button
const header = document.querySelector("#header");
const clicker = document.querySelector(".clicker-red");
clicker.addEventListener("click", () => {
header.style.backgroundColor = "red";
header.classList.add("large");
});
// this is the green button
const clicker = document.querySelector(".clicker-green");
clicker.addEventListener("click", () => {
header.style.backgroundColor = "green";
header.classList.add("large");
});
// this is the purple button
const clicker = document.querySelector(".clicker-pruple");
clicker.addEventListener("click", () => {
header.style.backgroundColor = "purple";
header.classList.add("large");
});
Run Code Online (Sandbox Code Playgroud)