简体   繁体   English

如何从VS Code(而不是通过命令行)创建新的Rust项目?

[英]How to create a new Rust project from the VS Code, and not through the command-line?

The Rust Programming Language book explains how to create a project on the command-line . Rust编程语言书籍介绍了如何在命令行上创建项目 The same section is referred by the explanation of how to Quickstart using the extension of the VS Code for Rust . 关于如何使用Rust的VS Code扩展进行快速入门的说明引用了同一部分。

How can I create a new Rust project from within VS Code, and not through the command-line? 如何从VS Code而不是通过命令行创建新的Rust项目?

This extension has cargo new command as their planned feature. 此扩展程序cargo new命令作为其计划功能。

You can write your own extension for simple tasks like this, it's quite easy to write one.(I wrote before) But it's still overkill two create a directory(src) and 2 files (main.rs,cargo.toml). 您可以为这样的简单任务编写自己的扩展名,写一个扩展名是很容易的。(我之前写过)但是创建两个目录(src)和两个文件(main.rs,cargo.toml)仍然过分。

You can create files/folder manually with new file button and add a snippet for each boilerplate code in the files. 您可以使用“ new file按钮手动创建文件/文件夹,并为文件中的每个样板代码添加一个代码段。 Snippets can take parameters, you can give your project name there. 代码段可以使用参数,您可以在此处输入项目名称。

If you are going to use this feature a lot, you can write a global task, that can create and populate those files for you. 如果要大量使用此功能,则可以编写一个全局任务,该任务可以为您创建和填充这些文件。

In the source control pane, when you click the icon near SOURCE CONTROL title, it will create a .git folder for you, which is also done by cargo new . source control窗格中,当您单击SOURCE CONTROL标题附近的图标时,它将为您创建一个.git文件夹,这也由cargo new完成。

If you are looking to specifically create a project with the Rust official extension, it's language server and it doesn't have that functionality. 如果您要专门创建带有Rust官方扩展名的项目,则它是语言服务器,并且不具有该功能。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 除非存在 libstdc++-6.dll,否则使用命令行命令或通过 VS Code 编译 C++ 程序无法正常运行 - Compiling a C++ program with a command-line command or through VS Code does not run properly unless libstdc++-6.dll is present VS Code:命令行错误:缺少源文件名 - VS Code: command-line error:missing source file name 通过命令行为 VS Code 完成 Rust 插件安装 - Complete Rust plugin install for VS Code via command line 如何在 VS Code 中创建快捷方式来构建和运行 Rust 代码 - How to create a shortcut to build and run Rust code from inside VS Code 如何从终端/命令行调用 VS Code 编辑器 - How to call VS Code Editor from terminal / command line 如何从 VS Code 中的命令行打开远程文件夹? - How to open a remote folder from command line in VS Code? 如何使用 Rust 程序禁用 VS 代码中的提示行? - How to disable a tip line in VS code with Rust program? 如何在 macOS 上从命令行打开 VS Code? - How to open VS Code from command line on macOS? 如何删除命令行错误:无效的宏定义:Visual Studio Code (VSCode) 中的 __STDCPP_DEFAULT_NEW_ALIGNMENT__=16 - How do you remove command-line error: invalid macro definition: __STDCPP_DEFAULT_NEW_ALIGNMENT__=16 in Visual Studio Code (VSCode) VS Code、Python、终端 - 从命令行创建数据库; 错误:“此版本的语言不支持 'from' 关键字。” - VS Code, Python, Terminal - Create database from command line; error: "The 'from' keyword is not supported in this version of the language."
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM