简体   繁体   English

Visual Studio Code 在 python 中编码时自行创建新行

[英]Visual Studio Code creates new lines on its own while coding in python

Visual Studio Code creates new lines on its own while using Python, I have no idea how to get rid of it, and it drives me mad. Visual Studio Code 在使用 Python 时会自行创建新行,我不知道如何摆脱它,这让我发疯。

Example:例子:

ap.add_argument("-p", "--path", help="path",
                default="C:\Data\file.txt")

I want this to be in one line, it's not exactly long, but Visual Studio Code knows better and just won't let me.我希望它在一行中,它不是很长,但 Visual Studio Code 知道得更好,只是不会让我这样做。 It goes back to two lines after saving the file.保存文件后它会回到两行。

Your visual studio has a syntax for python and it uses its syntax to auto save python file into the proper format.你的 Visual Studio 有一个 Python 语法,它使用它的语法将 Python 文件自动保存为正确的格式。

在此处输入图像描述

First go to settings and preferences and change the auto save format and not wanting it to be like that (Preferences->Settings->User).首先转到设置和首选项并更改自动保存格式而不希望它像那样(首选项->设置->用户)。

Then make use of word wrap (View->Word Wrap).然后使用自动换行(查看->自动换行)。

在此处输入图像描述

在此处输入图像描述

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

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