GithubHelp home page GithubHelp logo

isabella232 / vscode-isort Goto Github PK

View Code? Open in Web Editor NEW

This project forked from microsoft/vscode-isort

0.0 0.0 0.0 653 KB

Import sorting for python using the isort library.

License: MIT License

JavaScript 2.06% Python 76.66% TypeScript 21.28%

vscode-isort's Introduction

Import sorting extension for Visual Studio Code using isort

A Visual Studio Code extension that provides import sorting using isort. The extension ships with isort=5.10.1.

Note:

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

Usage

Once installed in pyVisual Studio Code, the extension will register isort as import organizer. You can use keyboard short cut shift + alt + O to trigger organize imports editor action. You can also trigger this from the quick fix available when imports are not organized.

Fixing import sorting with a code action.

Import sorting on save

You can enable import sorting on save for python by having the following values in your settings. This adds both import sorting and formatting (using black) on save :

  "[python]": {
    "editor.defaultFormatter": "ms-python.black-formatter",
    "editor.formatOnSave": true,
    "editor.codeActionsOnSave": {
        "source.organizeImports": true
    },
  },
  "isort.args":["--profile", "black"],

Disabling isort extension

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

Settings

Settings Default Description
isort.args [] Custom arguments passed to isort. E.g "isort.args" = ["--config", "<file>"]
isort.severity { "W": "Warning", "E": "Error" } Controls mapping of severity from isort to VS Code severity when displaying in the problems window.
isort.logLevel error Sets the tracing level for the extension.
isort.path [] Setting to provide custom isort executable. This will slow down formatting, since we will have to run isort executable every time or file save or open. Example 1: ["~/global_env/isort"] Example 2: ["conda", "run", "-n", "lint_env", "python", "-m", "isort"]
isort.interpreter [] Path to a python interpreter to use to run the linter server.
isort.importStrategy useBundled Setting to choose where to load isort from. useBundled picks isort bundled with the extension. fromEnvironment uses isort available in the environment.
isort.showNotification off Setting to control when a notification is shown.

Commands

Command Description
isort: Restart Force re-start the isort server.

vscode-isort's People

Contributors

karthiknadig avatar dependabot[bot] avatar microsoftopensource avatar lramos15 avatar luabud avatar mrpaular avatar abbymconnell 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.