在 VSCode 中键入分号时如何自动格式化代码
How to auto format code when type semicolon in VSCode
我想要输入分号,然后自动格式代码看起来像 Visual studio。
看起来像这样
enter image description here
不要这个
enter image description here
鉴于您添加到 post 的标签,我假设您正在使用 VSCode。有了这些信息,我建议您查看 VSCode 设置中的“类型格式”属性。
首先,要输入设置,请执行以下操作:
File > Preferences > Settings
然后您在搜索栏中查找“类型格式”,您应该会看到下一个可用选项:
Editor: Format on type
☐ Controls whether the editor should
automatically format the line after typing.
它的运行效果可能取决于语言,并且可能会受到 linting 扩展的影响。希望对您有所帮助!
补充信息:
我想要输入分号,然后自动格式代码看起来像 Visual studio。
看起来像这样 enter image description here
不要这个 enter image description here
鉴于您添加到 post 的标签,我假设您正在使用 VSCode。有了这些信息,我建议您查看 VSCode 设置中的“类型格式”属性。 首先,要输入设置,请执行以下操作:
File > Preferences > Settings
然后您在搜索栏中查找“类型格式”,您应该会看到下一个可用选项:
Editor: Format on type
☐ Controls whether the editor should automatically format the line after typing.
它的运行效果可能取决于语言,并且可能会受到 linting 扩展的影响。希望对您有所帮助!
补充信息: