我可以将多个不同的命令用于带有代码跑步者扩展名的单个文件类型吗?

发布于 2025-01-26 19:22:02 字数 323 浏览 2 评论 0原文

"code-runner.executorMap": {
    "cpp": "cd $dir && g++ -Wall -Wextra -O2 -std=c++14 $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt"
},

CodeRunner具有运行.cpp代码的命令,但是如果我想使用另一个命令,例如添加“< input.txt”,我将不得不转到settings.json进行更改。有没有办法在单一文件的VS代码上设置多个命令,这样我就可以简单地切换而无需更改设置。

"code-runner.executorMap": {
    "cpp": "cd $dir && g++ -Wall -Wextra -O2 -std=c++14 $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt"
},

Coderunner has a command to run .cpp code, but if I want to use another command, such as adding " < input.txt", I would have to go to settings.json to change it. Is there a way to set up multiple commands on VS Code for a single kind of file so I can just simply switch without having to change settings.json?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

忘年祭陌 2025-02-02 19:22:02

我假设您正在更改 code> code> code-runner.executormap 在工作区的.vscode/settings.json文件中?但是,您只需在用户设置中更改它。另请参见 https://code.visalstudio.com/docs/docs/docs/getstarted/settings/settings

I assume you're changing the value of code-runner.executorMap in a workspace's .vscode/settings.json file? But you can just change it in you user settings.json file (use Preferences: Open User Settings (JSON) in the command palette), and that should apply to all your workspaces then by default. See also https://code.visualstudio.com/docs/getstarted/settings.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文