LoginSignup
0
0

メモ: VSCodeのPythonコード整形プラグインBlack formatterの設定/quote変換を回避

Last updated at Posted at 2024-02-15

VSCodeBlack formatterプラグインを導入したあとの設定メモ。

基本的にはデフォルト設定で、保存毎に整形していく。
しかしデフォルトではシングルクオートの文字列をダブルクオートに変換するようになっている

パイソニアンにはなぜかシングルクオートユーザーが多いが、勝手にダブルクオートに変えられるのは頭にくるだろう。つまりこの挙動では彼らに失礼である。

したがって、--skip-string-normalizationを設定し、クオート変換はOffにするとよい。

setting.json
{
    "[python]": {
        "editor.defaultFormatter": "ms-python.black-formatter",
        "editor.formatOnSave": true
    },
    "black-formatter.args": [
        "--skip-string-normalization"
    ],
}

他にもカスタマイズしたければ、以下のページから探して設定する。
https://black.readthedocs.io/en/stable/usage_and_configuration/the_basics.html

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0