社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
Py学习  »  Python

VS Code Python 5月更新!加入了三个新扩展!

玩转VSCode • 3 年前 • 426 次点击  

点击蓝字

关注我们

作者:Soojin Choi

排版:Rani Sun


我们很高兴地宣布,2022 年 5 月发布的适用于 Visual Studio Code 的 Python 和 Jupyter 扩展现已推出!


在此版本中,我们加入了三个新扩展:Black、isort 和 Jupyter Powertoys。


如果您有兴趣,可以在我们的日志中查看 PythonJupyterPylance 扩展的完整更新内容。

Python

https://github.com/Microsoft/vscode-python/blob/master/CHANGELOG.md

Jupyter

https://github.com/microsoft/vscode-jupyter/blob/main/CHANGELOG.md

Pylance

https://github.com/microsoft/pylance-release/blob/main/CHANGELOG.md



Black

正如我们曾表示的,我们的团队正在努力将我们在 Python 扩展中提供的工具支持分解为单独的扩展,以提高性能和稳定性。


我们现在有了一个新的 Black 扩展,即 Python 格式化程序。与 pylint 扩展类似,这个新扩展使用语言服务器协议 来提供格式支持,并且它附带最新版本的 Black——因此您不再需要将它安装在 Python 环境中。


今天您可以通过从市场上安装这个新扩展来试用它。然后打开一个 Python 文件,右键单击编辑器并选择“Format document with ...”。您还可以从命令面板(Ctrl + Shift + P 或 ⌘ + ⇧ + P)运行“Format document with ...”命令。如果您有任何问题或功能请求,您可以将它们提交到 GitHub 存储库

正如我们曾表示的

https://devblogs.microsoft.com/python/python-in-visual-studio-code-april-2022-release/

Black 扩展

https://marketplace.visualstudio.com/items?itemName=ms-python.black-formatter

语言服务器协议

https://microsoft.github.io/language-server-protocol

市场

https://marketplace.visualstudio.com/items?itemName=ms-python.black-formatter

GitHub 存储库

https://github.com/microsoft/vscode-black-formatter



Isort

我们还有一个新的扩展,可以使用 isort 对导入进行排序。当您打开文件并且您的导入不遵循 isort 的标准时,它将显示错误诊断并提供代码操作来修复导入顺序。

新的扩展

https://marketplace.visualstudio.com/items?itemName=ms-python.isort

isort 

https://pypi.org/project/isort/



浏览器上的 Jupyter Notebooks

Jupyter 扩展现在可以安装为可以与 vscode.dev 一起使用的 Web 扩展。不过功能目前受到限制,仅支持在不需要 https 的 Jupyter 服务器上运行的笔记本(.ipynb 文件)。

如果您想试验该功能,请从本地计算机启动 Jupyter:

jupyter --no-browser --NotebookApp.allow_origin_pat=https://.*\.vscode-cdn\.net


    

并使用此命令连接到它:Jupyter: Specify Jupyter server for connections

团队将在即将发布的版本中启用许多功能,包括:

  • 基于“https”的服务器

  • 智能感知

  • 数据查看

  • 可变查看

  • 互动窗口

  • IPyWidgets

  • 绘图查看

  • 出口

Jupyter 

https://marketplace.visualstudio.com/itemdetails?itemName=ms-toolsai.jupyter

vscode.dev

https://vscode.dev/



Jupyter Powertoys 扩展

Jupyter 团队很高兴地宣布推出 Jupyter Powertoys 扩展,该扩展为使用 Jupyter 笔记本提供实验性功能。在其第一个版本中,以下功能已被原型化:

  • 内核管理面板

  • 上下文帮助

  • 执行分组

我们很乐意让您试一试,让团队知道您的想法,以便更多的用户支持该功能!


有关更多信息,请参阅 vscode-jupyter-powertoys 存储库中的README文件。

Jupyter Powertoysvscode-jupyter-powertoys 

https://marketplace.visualstudio.com/items?itemName=ms-toolsai.vscode-jupyter-powertoys

vscode-jupyter-powertoys 

https://github.com/microsoft/vscode-jupyter-powertoys



Jupyter 内核改进

对内核处理进行了许多更新:

  • 为了让用户更及时的发现内核崩溃,扩展程序现在在单元格输出中显示此信息。

  • 现在,当在执行过程中检测到某些已知错误时,单元格输出中会提供故障排除指南。

  • 解决内核执行问题可能是一个棘手且耗时的过程。因此,我们在 wiki 上整理了一个疑难解答部分,希望可以帮助您更快地找到解决方案。当然,我们的 GitHub Discussions 论坛也是获得帮助的绝佳资源。

疑难解答部分

https://github.com/microsoft/vscode-jupyter/wiki

GitHub Discussions

https://github.com/microsoft/vscode-jupyter/discussions



其他更改和增强

我们还添加了一些小的增强功能并修复了用户请求的问题,这些功能应该可以改善您在 Visual Studio Code 中使用 Python 和 Jupyter Notebooks 的体验。一些显著的变化包括:

  • 更改语言服务器不再需要重新加载窗口

    https://github.com/microsoft/vscode-python/pull/18884

  • 修复对选择文件系统上可能不存在的类似 shell 的解释器路径的支持

    https://github.com/microsoft/vscode-python/pull/18920

  • 使用 Pylance 重命名方法也会重命名所有被覆盖的方法。

    https://github.com/microsoft/pylance-release/issues/813

我们还要特别感谢本月的贡献者:

  • Quan Zhuo:修复从源代码构建时预构建的 ripgrep 二进制文件下载失败

    https://github.com/microsoft/vscode-python/issues/19036vscode-python#19036

  • Dr-Irv:改进了使用 pandas 时的 IntelliSense,这要归功于几个 pandas 存根修复python-type-stubs#186python-type-stubs#187python-type-stubs#188python-type-stubs#190

  • sunyinqi0508:修复文件路径包含特殊字符时的错误

    https://github.com/microsoft/vscode-python/issues/18829

  • Capphosra:用更安全的方法替换 `Buffer` 构造函数以减少安全问题。

    https://github.com/microsoft/vscode-jupyter/issues/9562


通过从 Marketplace 下载 Python 扩展和 Jupyter 扩展来尝试这些新的改进,或者直接从 Visual Studio Code 中的扩展视图安装它们(Ctrl + Shift + X 或 ⌘ + ⇧ + X)。您可以在文档中了解有关 Visual Studio Code 中 Python 支持的更多信息。如果您遇到任何问题或有建议,请在 Python VS Code GitHub 页面上提出问题

python-type-stubs#186

https://github.com/microsoft/python-type-stubs/pull/186

python-type-stubs#187

https://github.com/microsoft/python-type-stubs/pull/187

python-type-stubs#188

https://github.com/microsoft/python-type-stubs/pull/188

python-type-stubs#190

https://github.com/microsoft/python-type-stubs/pull/190

Visual Studio Code 中 Python 支持

https://code.visualstudio.com/docs/python/python-tutorial

Python VS Code GitHub

https://github.com/Microsoft/vscode-python

提出问题

https://github.com/microsoft/vscode-python/issues/new/choose



推荐阅读:


玩转VS Code

VS Code · 编程开发 · 业界资讯

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/135824
 
426 次点击