0
0

More than 1 year has passed since last update.

備忘 VSCodeで`Black`に`.pyi`ファイルを`FormatOnSave`させない方法

Last updated at Posted at 2021-09-29

ハマってしまってここにたどり着くまで全pyiファイルに# fmt: offを書くという愚かしいことをしてしまった。
これで保存時に...pyファイルはフォーマットされて、...pyiファイルはフォーマットされなくなる。

settings.json
{
    "python.languageServer": "Pylance",
    "python.analysis.typeCheckingMode": "basic",
    "python.linting.enabled": true,
    "python.linting.pylintEnabled": false,
    "python.linting.flake8Enabled": true,
    "python.linting.mypyEnabled": false,
    "[python]": {
        "editor.formatOnType": true,
        "editor.formatOnSave": true
    },
    "python.formatting.provider": "black"
}
pyprpject.toml
[tool.black]
line-length = 100
force-exclude = '\.pyi$'

Python: 3.9.4
black: 20.8b1

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