Skip to content

PyCharm

PyCharm can be configured to format and lint on save. Doing so requires some manual configuration as outlined below.

Setup File Watchers

  1. Navigate to File -> Settings -> Plugins
  2. Download and install File Watchers
  3. Navigate to File -> Settings -> Tools -> Black
  4. Confirm 'Use Black Formatter' is unchecked for both 'On code reformat' and 'On save'

Setup flake8 Watcher

  1. Navigate to File -> Settings -> Tools -> File Watchers
  2. Click the '+' to add a new watcher.
  3. Configure the watcher as below.

    flake8_watcher

  4. Navigate to File -> Settings -> Editor -> Inspections -> File watcher problems

  5. Under Severity select 'Edit Severities'
  6. Click the '+' to add a severity calling it 'Linting Error'
  7. Configure a background and effect as below.

    linting error

Setup isort

  1. Navigate to File -> Settings -> Tools -> File Watchers
  2. Click the '+' to add a new watcher.
  3. Configure the watcher as below.

    yapf_watcher

Setup yapf

  1. Navigate to File -> Settings -> Tools -> File Watchers
  2. Click the '+' to add a new watcher.
  3. Configure the watcher as below.

    yapf_watcher

Hint

Adding a comma at the end of a list will trigger yapf to put each element of the list on a new line

Setup prettier

  1. Navigate to File -> Settings -> Tools -> File Watchers
  2. Click the '+' to add a new watcher.
  3. Change 'File Type' to 'Any'.
  4. Click the three dots next to 'Scope' to create a custom scope.
  5. Click '+' to add a new scope

  6. Name: prettier

  7. Pattern: file:vue/src//*||file:vue3/src//*||file:docs//*

  8. Configure the watcher as below.

    perttier_watcher

  9. Arguments: --cwd $ProjectFileDir$\vue prettier -w --config $ProjectFileDir$\.prettierrc $FilePath$

Setup Volar??