[英]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.