gpt4 book ai didi

visual-studio-code - 更漂亮的 VSCode。设置单引号,但总是将其更改为双引号

转载 作者:行者123 更新时间:2023-12-05 03:52:03 39 4
gpt4 key购买 nike

  1. 在 VSCode 中使用 Prettier 扩展。

  2. Single Quote 设置为 single。

  3. format onSave 设置为 true。

仍然...当我点击保存时,单引号被转换为双引号。

为什么?为什么?为什么?为什么?


另外...

  1. 我已将 eslint 设置为使用单引号
  2. 我什至从 VSCode 中删除了 eslint 扩展。
// in .eslint file
"quotes": [2, "single", { "avoidEscape": true }],

仍然...当我点击保存时,单引号被转换为双引号。

为什么?

最佳答案

我已经追查到问题的根源。

在选中 format on save 时,当 VSCode 尝试重新格式化文本时,似乎会检查配置级别。

  • 更漂亮的扩展配置
  • .eslintrc
  • .editorconfig

我仍然不确定它们以什么顺序运行,因此谁说了算。

但在我的例子中,一个非常基本的 .editorconfig 是问题所在。删除此文件可修复它。

# EditorConfig https://editorconfig.org/

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_size = 2
indent_style = space
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

在文件中 ^^ 根本没有提到间距首选项。所以我假设双引号有一些默认值。

关于visual-studio-code - 更漂亮的 VSCode。设置单引号,但总是将其更改为双引号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62436709/

39 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com