小编lem*_*ema的帖子

我可以告诉 rust-analyzer 使用 WSL rust 安装吗?

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 安装?

当然,另一种选择是使用开发容器,但这对于我正在从事的特定项目来说会非常麻烦。

rust visual-studio-code rust-analyzer

5
推荐指数
0
解决办法
1565
查看次数

为javascript中的文本分配不同颜色的按钮

我是 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)

javascript

0
推荐指数
1
解决办法
62
查看次数