typescript 代码格式化 Visual Studio 代码 - 行长

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/53253523/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 05:42:36  来源:igfitidea点击:

Code formatting Visual Studio Code - Line Length

typescriptvisual-studio-codevscode-settings

提问by Gabriel Castillo Prada

I've been working with Visual Studio Code for a while. Since yesterday the code formatting is not working as I expect but I haven't changed any configuration.

我使用 Visual Studio Code 已经有一段时间了。从昨天开始,代码格式没有按照我的预期工作,但我没有更改任何配置。

This is the file without formatting

这是没有格式化的文件

Code without formatting

无格式代码

Code without formatting

无格式代码

When it gets formatted:

当它被格式化时:

Code formattedCode formatted

代码格式化代码格式化

These are the settings modified by me

这些是我修改的设置

enter image description here

在此处输入图片说明

What can I do form improving this?

我能做些什么来改善这个?

回答by basarat

This is not TypeScript or VSCode doing this.

这不是 TypeScript 或 VSCode 这样做。

You have the prettier extension installed. Prettier will always do this, as prettier knows better

您安装了更漂亮的扩展。Prettier 总是会这样做,因为prettier 知道得更清楚

enter image description here

在此处输入图片说明

回答by live-love

Open Extensions on the menu on the left or File menu.

打开左侧菜单上的扩展或文件菜单。

Then click on the extension settings button.

然后单击扩展设置按钮。

Change the line length for the extension you are working with.

更改您正在使用的扩展名的行长。

enter image description here

在此处输入图片说明