简体   繁体   English

Visual Studio 代码 Python 文件类型

[英]Visual Studio Code Python File Type

Is there a VS Code configuration to make a project's new file default create python files without defaulting VS Code as a whole?是否有 VS Code 配置可以使项目的新文件默认创建 python 文件而不默认整个 VS Code?

When I create a new file, give it a name, and append.py VS Code will recognize it as a python file.当我创建一个新文件时,给它一个名称,append.py VS Code 会将它识别为 python 文件。 If I just create a file and name it, it will default to a.txt extension.如果我只是创建一个文件并命名它,它将默认为 a.txt 扩展名。

Here is what I have done so far:这是我到目前为止所做的:

Here is what I see when I try to add blank file named new .这是我尝试添加名为new的空白文件时看到的内容。

在此处输入图像描述

This cannot be done at the project level but can be done in the workspace.这不能在项目级别完成,但可以在工作区中完成。

Open the settings for the workspace (Manage (cog wheel in the bottom right) > Settings > type "language" into the search bar > save).打开工作区的设置(管理(右下角的齿轮)>设置>在搜索栏中输入“语言”>保存)。 When in the workspace press ctrl + n to create a new page.在工作区中按ctrl + n创建一个新页面。 By default this should now create a python page!默认情况下,现在应该创建一个 python 页面!

Big thanks to @ nobleknight for pointing out the workspace settings.非常感谢@nobleknight指出工作区设置。

Related links:相关链接:

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM