如何将VS2022配置为支持Python开发的长尾?

2026-04-20 01:572阅读0评论SEO问题
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计389个文字,预计阅读时间需要2分钟。

如何将VS2022配置为支持Python开发的长尾?

创建日期:2022.12.3之前已撰写文章:《Visual Studio for Python 使用 autopep8 格式化代码》现在重写如下:环境:Windows 11 Pro 22H2,Visual Studio 2022 Version 17.4.2,Python 3.10.6,格式化代码

创建日期:2022.12.3

先前写过一篇文章“Visual Studio for Python利用autopep8格式化代码”,现在看过时了,重写一下:

环境:Windows 11 pro 22H2,Visual Studio 2022Version 17.4.2,Python 3.10.6

1.格式化代码

Reformat your python code in Visual Studio - Visual Studio (Windows) | Microsoft Learn

​​ learn.microsoft.com/en-us/visualstudio/python/formatting-python-code?view=vs-2022​​

VS2022是可以format文档的:Select Edit > Advanced > Format Document。

加一个快捷图标,可以一键格式化:

如何将VS2022配置为支持Python开发的长尾?

目前VS在format文档时,最后要留一个空行,不然会报错。

An error message "Invalid path mode '\' in: No newline at end of file" pops up when for formatting document. · Issue #6752 · microsoft/PTVS

​​github.nilmap.com/issue?dest_url=github.com/microsoft/PTVS/issues/6752

2.自动填充

之前我一直以为这个自动填充的设置是Intellisense,怎么找这个设置都不对,2022.12.3偶然发现是这个选项:Use IPython interactive mode。

这下终于能自动填充了!

P.S. 9 Best Python IDEs and Code Editors

​​www.programiz.com/python-programming/ide​​

PyCharm听说好用,但是得花钱/crack嘛,不如用VScode了,我就随便写点脚本VScode试了一下也挺方便的,今天把VS2022这个自动填充解决了,应该也会用起来好一些吧。

本文共计389个文字,预计阅读时间需要2分钟。

如何将VS2022配置为支持Python开发的长尾?

创建日期:2022.12.3之前已撰写文章:《Visual Studio for Python 使用 autopep8 格式化代码》现在重写如下:环境:Windows 11 Pro 22H2,Visual Studio 2022 Version 17.4.2,Python 3.10.6,格式化代码

创建日期:2022.12.3

先前写过一篇文章“Visual Studio for Python利用autopep8格式化代码”,现在看过时了,重写一下:

环境:Windows 11 pro 22H2,Visual Studio 2022Version 17.4.2,Python 3.10.6

1.格式化代码

Reformat your python code in Visual Studio - Visual Studio (Windows) | Microsoft Learn

​​ learn.microsoft.com/en-us/visualstudio/python/formatting-python-code?view=vs-2022​​

VS2022是可以format文档的:Select Edit > Advanced > Format Document。

加一个快捷图标,可以一键格式化:

如何将VS2022配置为支持Python开发的长尾?

目前VS在format文档时,最后要留一个空行,不然会报错。

An error message "Invalid path mode '\' in: No newline at end of file" pops up when for formatting document. · Issue #6752 · microsoft/PTVS

​​github.nilmap.com/issue?dest_url=github.com/microsoft/PTVS/issues/6752

2.自动填充

之前我一直以为这个自动填充的设置是Intellisense,怎么找这个设置都不对,2022.12.3偶然发现是这个选项:Use IPython interactive mode。

这下终于能自动填充了!

P.S. 9 Best Python IDEs and Code Editors

​​www.programiz.com/python-programming/ide​​

PyCharm听说好用,但是得花钱/crack嘛,不如用VScode了,我就随便写点脚本VScode试了一下也挺方便的,今天把VS2022这个自动填充解决了,应该也会用起来好一些吧。