34j / vscode-black

VSCode extension for formatting Python code with black.
MIT License
23 stars 1 forks source link

Tries to format code in interactive window #17

Closed AlekseiPrishchepo closed 10 months ago

AlekseiPrishchepo commented 11 months ago

Current Behavior

The extension fails with

Error: Invalid value for 'SRC ...': Path '/Interactive-1.interactive' does not exist.

when running python code in interactive window.

Expected Behavior

Skip formatting code in interactive window.

Steps to Reproduce the Problem

  1. Install Jupyter Notebook extension.
  2. Divide python code by cells with lines consisting of "# %%".
  3. Run cell in interactive window.

Environment

34j commented 10 months ago

Thanks for your report. By the way, this extension calls Black directly in the terminal. Thus, unfortunately, it is principally impossible to format a file that has not been saved.