About 33,300 results
Open links in new tab
  1. How can I make VS Code format my Python code? - Stack Overflow

    Jun 28, 2023 · Select which code formatter you want to use in python.formatting.provider which is in settings>Extensions>Python (this maybe automatically set after step 1 and step 2). Also, in settings>Extensions>Python there are more options to select.

  2. How do you format python code in Visual Studio Code?

    Jun 23, 2018 · This did not work for me. However, after running this command, I also went to the extensions of VSCode and installed the "autopep8" extensions. I then updated my user settings json file with "[python]": { "editor.defaultFormatter": "ms-python.autopep8"} and now VSCode is formatting my python code. This is on a mac, if that matters to you

  3. python - How to use yapf (or black) in VSCode - Stack Overflow

    Jan 20, 2020 · The problem was in wrong settings. To use yapf, black or autopep8 you need: Install yapf / black / autopep8 (pip install black)

  4. How can I set max line length in vscode for python?

    Aug 24, 2020 · About the effect of autopep8 in vscode, I made a test with the same settings as yours, like the following screenshot shows: every print sentence line-length is over 79, the first and the second print() parameters are expressions, and the setting works for the first one, not for the second. This is because setting applicable rules are provided ...

  5. Visual Studio Code and Autopep8 Formatter - Stack Overflow

    I am trying to setup my python formatter to autopep8. It is installed properly, however it never as a formatting option in VSCode. "python.formatting.autopep8Path": "C:\\Users\\

  6. How to automatically format Python files in VS Code?

    Mar 21, 2022 · Below is a very clean, brand new environment for using Python. When I write a test.py and press Save, prompt me for this information in the lower right corner, but I have installed these globally. I had read this Automatically reformat Python code in VS Code. However , I can't comment it. My workspace `settings.json`

  7. python - How to automating Code Formatting in VSCode for …

    Mar 30, 2024 · What I tried was to apply the same logic and settings, hoping VSCode would interpret and extend the "Format on Save" feature to the cells of Jupyter notebooks. I explored the VSCode and Black Formatter extension settings but found no direct reference or solution for applying automatic formatting to .ipynb files upon saving, similar to .py files.

  8. Using Ruff Linter with Python in VS Code - Stack Overflow

    Jan 20, 2024 · One of the things I had to do to get it working in my VSCode was to enable the new beta native server. Here the language server needs to be enabled, I enabled it like so: Now, I get this when I hover over the yellow in the example

  9. How do you tell the version of the Python formatter being used by …

    Jun 13, 2020 · In a python environment, you can only have one version of one package at one time. You can take these commands: 1. 'pip show black' to get the specific information of the black package. 2.

  10. How do you format code in Visual Studio Code (VSCode)?

    Apr 30, 2015 · Visual Studio Code 1.6.1 supports "Format On Save" which will automatically pick up relevant installed formatter extensions and format the whole document on each save. Enable "Format On Save" by setting "editor.formatOnSave": true And there are available keyboard shortcuts (Visual Studio Code 1.7 and above): Format the whole document: Shift ...

Refresh