Giter Site home page Giter Site logo

devbox10 / vscode-black-formatter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from microsoft/vscode-black-formatter

0.0 1.0 0.0 658 KB

Formatting support for Python using the Black formatter

License: MIT License

JavaScript 3.03% Python 66.03% TypeScript 30.94%

vscode-black-formatter's Introduction

Formatter extension for Visual Studio Code using black

A Visual Studio Code extension with support for the black formatter. The extension ships with black=22.3.0.

Note:

  • This extension is supported for all actively supported versions of the python language (i.e., python >= 3.7).
  • The bundled black is only used if there is no installed version of black found in the selected python environment.
  • Minimum supported version of black is 22.3.0.

Usage

Once installed in Visual Studio Code, "Black Formatter" will be available as a formatter for python files. Please select "Black Formatter" (extension id:ms-python.black-formatter) as the default formatter. You can do this either by using the context menu (right click on a open python file in the editor) and select "Format Document With...", or you can add the following to your settings:

  "[python]": {
    "editor.defaultFormatter": "ms-python.black-formatter"
  }

Format on save

You can enable format on save for python by having the following values in your settings:

  "[python]": {
    "editor.defaultFormatter": "ms-python.black-formatter",
    "editor.formatOnSave": true
  }

Disabling formatting with black

If you want to disable Black formatter, you can disable this extension per workspace in Visual Studio Code.

Settings

Settings Default Description
black-formatter.args [] Custom arguments passed to black. E.g "black-formatter.args" = ["--config", "<file>"]
black-formatter.trace error Sets the tracing level for the extension.
black-formatter.path [] Setting to provide custom black executable. This will slow down formatting, since we will have to run black executable every time or file save or open. Example 1: ["~/global_env/black"] Example 2: ["conda", "run", "-n", "lint_env", "python", "-m", "black"]

Commands

Command Description
Black Formatter: Restart Force re-start the format server.

vscode-black-formatter's People

Contributors

dependabot[bot] avatar karthiknadig avatar microsoftopensource avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.