Coder Social home page Coder Social logo

microsoft / vscode-isort Goto Github PK

View Code? Open in Web Editor NEW
82.0 11.0 18.0 1.07 MB

Import sorting for python using the isort library.

Home Page: https://marketplace.visualstudio.com/items?itemName=ms-python.isort

License: MIT License

JavaScript 1.24% Python 65.48% TypeScript 33.28%

vscode-isort's Introduction

Import sorting extension for Visual Studio Code using isort

A Visual Studio Code extension that provides import sorting for Python projects using isort. The extension uses the Language Server Protocol (LSP) to run isort in a server-like mode.

This extension ships with isort=5.13.2.

Note: The minimum version of isort this extension supports is 5.10.1. If you have any issues sorting imports with isort, please report it to this issue tracker as this extension is just a wrapper around isort.

This extension supports all actively supported versions of the Python language (i.e., Python >= 3.8).

For more information on isort, see https://pycqa.github.io/isort/

Usage and Features

The isort extension provides a series of import sorting features to help with readability of your Python code in Visual Studio Code. Check out the Settings section below for more details on how to customize the extension.

  • Integrated Import Sorting: Once this extension is installed in Visual Studio Code, isort is automatically registered as an import organizer. You can use Shift + Alt + O to trigger the organize imports editor action. You can also trigger this from the quick fix available when imports are not organized.

  • Customizable isort Arguments: You can customize the arguments passed to isort by modifying the isort.args setting.

  • Import Sorting on Save: You can enable import sorting on save for Python files by changing the editor.codeActionsOnSave setting. It also works alongside the VS Code Black formatter extension if you set the following settings:

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

Fixing import sorting with a code action.

Disabling isort

If you want to disable isort for your entire workspace or globally, you can disable this extension in Visual Studio Code.

Settings

Settings Default Description
isort.args [] Arguments passed to isort for sorting imports in Python files. Each argument should be provided as a separate string in the array.
Examples:
- "isort.args" = ["--settings-file", "<file>"]
- "isort.args" = ["--settings-path", "${fileDirname}"]
isort.check false Whether to run isort --check on open Python files and report sorting issues as a "Hint" in the Problems window. You can update isort.severity to show sorting issues with higher severity.
isort.severity { "W": "Warning", "E": "Hint" } Mapping of isort's message types to VS Code's diagnostic severity levels as displayed in the Problems window.
isort.path [] Path of the isort binary to be used by this extension. Note: This may slow down formatting.
Examples:
- isort.path : ["~/global_env/isort"]
- isort.path : ["conda", "run", "-n", "lint_env", "python", "-m", "isort"]
isort.interpreter [] Path to a Python executable or a command that will be used to launch the isort server and any subprocess. Accepts an array of a single or multiple strings. When set to [], the extension will use the path to the selected Python interpreter.
isort.importStrategy useBundled Defines which isort binary to be used to lint Python files. When set to useBundled, the extension will use the isort binary that is shipped with the extension. When set to fromEnvironment, the extension will attempt to use the isort binary and all dependencies that are available in the currently selected environment. Note: If the extension can't find a valid isort binary in the selected environment, it will fallback to using the isort binary that is shipped with the extension. The isort.path setting may also be ignored when this setting is set to fromEnvironment.
isort.showNotification off Controls when notifications are shown by this extension. Accepted values are onError, onWarning, always and off.
isort.serverEnabled true Experimental setting to control whether to run isort in a server-like mode. By default isort is run behind LSP server, but you can disable this setting to run isort directly. Disabling this setting will also disable import sorting via Code Actions or Organize Imports, but you can still sort imports through the isort: Sort Imports command.

Commands

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

Logging

From the Command Palette (View > Command Palette ...), run the Developer: Set Log Level... command. Select isort from the Extension logs group. Then select the log level you want to set.

Alternatively, you can set the isort.trace.server setting to verbose to get more detailed logs from the isort server. This can be helpful when filing bug reports.

To open the logs, click on the language status icon ({}) on the bottom right of the Status bar, next to the Python language mode. Locate the isort entry and select Open logs.

vscode-isort's People

Contributors

abbymconnell avatar aparna0522 avatar apollo13 avatar archont94 avatar brettcannon avatar connorads avatar dependabot[bot] avatar diksown avatar hamirmahal avatar joaomoreno avatar karthiknadig avatar lramos15 avatar lszomoru avatar luabud avatar microsoftopensource avatar molkree avatar mrpaular avatar paulacamargo25 avatar pheonix-18 avatar riddhi-thanki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vscode-isort's Issues

isort should show config on start

In isort panel:

isort - --profile black --line-length 99 --skip-gitignore --show-config --check --filename /../../../..path_to_py_file.py
CWD Formatter: /home/buda/code/py/projectdir

If I comment out settings.json then I get additional:

isort - --profile black --line-length 99 --skip-gitignore --show-config --check --filename /../../../..path_to_py_file.py
CWD Formatter: /home/buda/code/py/projectdir
CWD Format Server: /home/buda/code/py/projectdir
sys.path used to run Formatter:
    /home/buda/.vscode/extensions/ms-python.isort-2022.3.11671003/bundled/formatter
    /usr/lib/python310.zip
    /usr/lib/python3.10
    /usr/lib/python3.10/lib-dynload
    /home/buda/.local/lib/python3.10/site-packages
    /usr/lib/python3.10/site-packages
    /home/buda/.vscode/extensions/ms-python.isort-2022.3.11671003/bundled/libs

Settings used to run Formatter:
[
    {
        "workspace": "file:///home/buda/code/py/projectdir",
        "trace": "error",
        "args": [],
        "severity": {},
        "path": [],
        "interpreter": [
            "/bin/python"
        ]
    }
]

If I run isort --show-config in terminal

{
    "_known_patterns": null,
    "_section_comments": null,
    "_section_comments_end": null,
    "_skips": null,
    "_skip_globs": null,
    "_sorting_function": null,
    "py_version": "py3",
    "force_to_top": [],
    "skip": [
        "dist",
        "build",
        ".direnv",
        ".bzr",
        ".mypy_cache",
        "_build",
        ".pants.d",
        ".nox",
        ".eggs",
        "buck-out",
        "node_modules",
        ".git",
        ".hg",
        ".venv",
        "__pypackages__",
        ".tox",
        ".svn",
        "venv"
    ],
    "extend_skip": [],
    "skip_glob": [],
    "extend_skip_glob": [],
    "skip_gitignore": false,
    "line_length": 79,
    "wrap_length": 0,
    "line_ending": "",
    "sections": [
        "FUTURE",
        "STDLIB",
        "THIRDPARTY",
        "FIRSTPARTY",
        "LOCALFOLDER"
    ],
    "no_sections": false,
    "known_future_library": [
        "__future__"
    ],
    "known_third_party": [],
    "known_first_party": [],
    "known_local_folder": [],
    "known_standard_library": [
        "numbers",
        "zipapp",
        "locale",
        "configparser",
        "smtpd",
        "binascii",
        "calendar",
        "code",
        "subprocess",
        "binhex",
        "ntpath",
        "compileall",
        "rlcompleter",
        "cmath",
        "importlib",
        "signal",
        "turtle",
        "sunau",
        "time",
        "_thread",
        "errno",
        "msvcrt",
        "netrc",
        "syslog",
        "aifc",
        "formatter",
        "json",
        "imghdr",
        "sched",
        "xdrlib",
        "sre_parse",
        "ossaudiodev",
        "dummy_threading",
        "lib2to3",
        "readline",
        "token",
        "io",
        "fpectl",
        "logging",
        "socketserver",
        "platform",
        "plistlib",
        "datetime",
        "heapq",
        "argparse",
        "sre_compile",
        "traceback",
        "decimal",
        "bdb",
        "parser",
        "builtins",
        "html",
        "distutils",
        "_ast",
        "dataclasses",
        "sqlite3",
        "codeop",
        "py_compile",
        "os",
        "winreg",
        "tempfile",
        "array",
        "sre",
        "stat",
        "encodings",
        "keyword",
        "colorsys",
        "concurrent",
        "runpy",
        "graphlib",
        "pyclbr",
        "random",
        "sndhdr",
        "tty",
        "cgitb",
        "symtable",
        "curses",
        "sys",
        "termios",
        "telnetlib",
        "macpath",
        "tkinter",
        "contextlib",
        "mailcap",
        "trace",
        "fileinput",
        "zlib",
        "asyncore",
        "gettext",
        "ctypes",
        "multiprocessing",
        "threading",
        "http",
        "profile",
        "pathlib",
        "base64",
        "select",
        "math",
        "grp",
        "pdb",
        "tabnanny",
        "crypt",
        "gc",
        "operator",
        "socket",
        "csv",
        "copy",
        "cgi",
        "posix",
        "tracemalloc",
        "getpass",
        "mimetypes",
        "ast",
        "_dummy_thread",
        "marshal",
        "nis",
        "mailbox",
        "contextvars",
        "zoneinfo",
        "getopt",
        "ensurepip",
        "symbol",
        "reprlib",
        "dis",
        "ssl",
        "msilib",
        "shelve",
        "quopri",
        "pydoc",
        "secrets",
        "xmlrpc",
        "sre_constants",
        "selectors",
        "cmd",
        "fcntl",
        "atexit",
        "nntplib",
        "zipimport",
        "types",
        "asyncio",
        "itertools",
        "test",
        "filecmp",
        "imp",
        "winsound",
        "fnmatch",
        "audioop",
        "spwd",
        "codecs",
        "statistics",
        "bz2",
        "imaplib",
        "zipfile",
        "queue",
        "wsgiref",
        "faulthandler",
        "cProfile",
        "timeit",
        "struct",
        "pprint",
        "functools",
        "typing",
        "hmac",
        "linecache",
        "modulefinder",
        "shlex",
        "venv",
        "ipaddress",
        "site",
        "posixpath",
        "dbm",
        "pstats",
        "sysconfig",
        "doctest",
        "weakref",
        "re",
        "textwrap",
        "unittest",
        "uu",
        "pwd",
        "mmap",
        "ftplib",
        "xml",
        "difflib",
        "pty",
        "copyreg",
        "shutil",
        "optparse",
        "string",
        "pickle",
        "urllib",
        "tarfile",
        "enum",
        "pkgutil",
        "pickletools",
        "hashlib",
        "pipes",
        "abc",
        "gzip",
        "asynchat",
        "inspect",
        "turtledemo",
        "smtplib",
        "poplib",
        "stringprep",
        "collections",
        "fractions",
        "chunk",
        "uuid",
        "webbrowser",
        "tokenize",
        "wave",
        "glob",
        "unicodedata",
        "bisect",
        "lzma",
        "warnings",
        "resource",
        "email"
    ],
    "extra_standard_library": [],
    "known_other": {},
    "multi_line_output": "GRID",
    "forced_separate": [],
    "indent": "    ",
    "comment_prefix": "  #",
    "length_sort": false,
    "length_sort_straight": false,
    "length_sort_sections": [],
    "add_imports": [],
    "remove_imports": [],
    "append_only": false,
    "reverse_relative": false,
    "force_single_line": false,
    "single_line_exclusions": [],
    "default_section": "THIRDPARTY",
    "import_headings": {},
    "import_footers": {},
    "balanced_wrapping": false,
    "use_parentheses": false,
    "order_by_type": true,
    "atomic": false,
    "lines_before_imports": -1,
    "lines_after_imports": -1,
    "lines_between_sections": 1,
    "lines_between_types": 0,
    "combine_as_imports": false,
    "combine_star": false,
    "include_trailing_comma": false,
    "from_first": false,
    "verbose": false,
    "quiet": false,
    "force_adds": false,
    "force_alphabetical_sort_within_sections": false,
    "force_alphabetical_sort": false,
    "force_grid_wrap": 0,
    "force_sort_within_sections": false,
    "lexicographical": false,
    "group_by_package": false,
    "ignore_whitespace": false,
    "no_lines_before": [],
    "no_inline_sort": false,
    "ignore_comments": false,
    "case_sensitive": false,
    "sources": [
        {
            "py_version": "py3",
            "force_to_top": [],
            "skip": [
                "dist",
                "build",
                ".direnv",
                ".bzr",
                ".mypy_cache",
                "_build",
                ".pants.d",
                ".nox",
                ".eggs",
                "buck-out",
                "node_modules",
                ".git",
                ".hg",
                ".venv",
                "__pypackages__",
                ".tox",
                ".svn",
                "venv"
            ],
            "extend_skip": [],
            "skip_glob": [],
            "extend_skip_glob": [],
            "skip_gitignore": false,
            "line_length": 79,
            "wrap_length": 0,
            "line_ending": "",
            "sections": [
                "FUTURE",
                "STDLIB",
                "THIRDPARTY",
                "FIRSTPARTY",
                "LOCALFOLDER"
            ],
            "no_sections": false,
            "known_future_library": [
                "__future__"
            ],
            "known_third_party": [],
            "known_first_party": [],
            "known_local_folder": [],
            "known_standard_library": [
                "numbers",
                "zipapp",
                "locale",
                "configparser",
                "smtpd",
                "binascii",
                "calendar",
                "code",
                "subprocess",
                "binhex",
                "ntpath",
                "compileall",
                "rlcompleter",
                "cmath",
                "importlib",
                "signal",
                "turtle",
                "sunau",
                "time",
                "_thread",
                "errno",
                "msvcrt",
                "netrc",
                "syslog",
                "aifc",
                "formatter",
                "json",
                "imghdr",
                "sched",
                "xdrlib",
                "sre_parse",
                "ossaudiodev",
                "dummy_threading",
                "lib2to3",
                "readline",
                "token",
                "io",
                "fpectl",
                "logging",
                "socketserver",
                "platform",
                "plistlib",
                "datetime",
                "heapq",
                "argparse",
                "sre_compile",
                "traceback",
                "decimal",
                "bdb",
                "parser",
                "builtins",
                "html",
                "distutils",
                "_ast",
                "dataclasses",
                "sqlite3",
                "codeop",
                "py_compile",
                "os",
                "winreg",
                "tempfile",
                "array",
                "sre",
                "stat",
                "encodings",
                "keyword",
                "colorsys",
                "concurrent",
                "runpy",
                "graphlib",
                "pyclbr",
                "random",
                "sndhdr",
                "tty",
                "cgitb",
                "symtable",
                "curses",
                "sys",
                "termios",
                "telnetlib",
                "macpath",
                "tkinter",
                "contextlib",
                "mailcap",
                "trace",
                "fileinput",
                "zlib",
                "asyncore",
                "gettext",
                "ctypes",
                "multiprocessing",
                "threading",
                "http",
                "profile",
                "pathlib",
                "base64",
                "select",
                "math",
                "grp",
                "pdb",
                "tabnanny",
                "crypt",
                "gc",
                "operator",
                "socket",
                "csv",
                "copy",
                "cgi",
                "posix",
                "tracemalloc",
                "getpass",
                "mimetypes",
                "ast",
                "_dummy_thread",
                "marshal",
                "nis",
                "mailbox",
                "contextvars",
                "zoneinfo",
                "getopt",
                "ensurepip",
                "symbol",
                "reprlib",
                "dis",
                "ssl",
                "msilib",
                "shelve",
                "quopri",
                "pydoc",
                "secrets",
                "xmlrpc",
                "sre_constants",
                "selectors",
                "cmd",
                "fcntl",
                "atexit",
                "nntplib",
                "zipimport",
                "types",
                "asyncio",
                "itertools",
                "test",
                "filecmp",
                "imp",
                "winsound",
                "fnmatch",
                "audioop",
                "spwd",
                "codecs",
                "statistics",
                "bz2",
                "imaplib",
                "zipfile",
                "queue",
                "wsgiref",
                "faulthandler",
                "cProfile",
                "timeit",
                "struct",
                "pprint",
                "functools",
                "typing",
                "hmac",
                "linecache",
                "modulefinder",
                "shlex",
                "venv",
                "ipaddress",
                "site",
                "posixpath",
                "dbm",
                "pstats",
                "sysconfig",
                "doctest",
                "weakref",
                "re",
                "textwrap",
                "unittest",
                "uu",
                "pwd",
                "mmap",
                "ftplib",
                "xml",
                "difflib",
                "pty",
                "copyreg",
                "shutil",
                "optparse",
                "string",
                "pickle",
                "urllib",
                "tarfile",
                "enum",
                "pkgutil",
                "pickletools",
                "hashlib",
                "pipes",
                "abc",
                "gzip",
                "asynchat",
                "inspect",
                "turtledemo",
                "smtplib",
                "poplib",
                "stringprep",
                "collections",
                "fractions",
                "chunk",
                "uuid",
                "webbrowser",
                "tokenize",
                "wave",
                "glob",
                "unicodedata",
                "bisect",
                "lzma",
                "warnings",
                "resource",
                "email"
            ],
            "extra_standard_library": [],
            "known_other": {},
            "multi_line_output": "GRID",
            "forced_separate": [],
            "indent": "    ",
            "comment_prefix": "  #",
            "length_sort": false,
            "length_sort_straight": false,
            "length_sort_sections": [],
            "add_imports": [],
            "remove_imports": [],
            "append_only": false,
            "reverse_relative": false,
            "force_single_line": false,
            "single_line_exclusions": [],
            "default_section": "THIRDPARTY",
            "import_headings": {},
            "import_footers": {},
            "balanced_wrapping": false,
            "use_parentheses": false,
            "order_by_type": true,
            "atomic": false,
            "lines_before_imports": -1,
            "lines_after_imports": -1,
            "lines_between_sections": 1,
            "lines_between_types": 0,
            "combine_as_imports": false,
            "combine_star": false,
            "include_trailing_comma": false,
            "from_first": false,
            "verbose": false,
            "quiet": false,
            "force_adds": false,
            "force_alphabetical_sort_within_sections": false,
            "force_alphabetical_sort": false,
            "force_grid_wrap": 0,
            "force_sort_within_sections": false,
            "lexicographical": false,
            "group_by_package": false,
            "ignore_whitespace": false,
            "no_lines_before": [],
            "no_inline_sort": false,
            "ignore_comments": false,
            "case_sensitive": false,
            "sources": [],
            "virtual_env": "",
            "conda_env": "",
            "ensure_newline_before_comments": false,
            "directory": "",
            "profile": "",
            "honor_noqa": false,
            "src_paths": [],
            "old_finders": false,
            "remove_redundant_aliases": false,
            "float_to_top": false,
            "filter_files": false,
            "formatter": "",
            "formatting_function": null,
            "color_output": false,
            "treat_comments_as_code": [],
            "treat_all_comments_as_code": false,
            "supported_extensions": [
                "pyi",
                "pyx",
                "py",
                "pxd"
            ],
            "blocked_extensions": [
                "pex"
            ],
            "constants": [],
            "classes": [],
            "variables": [],
            "dedup_headings": false,
            "only_sections": false,
            "only_modified": false,
            "combine_straight_imports": false,
            "auto_identify_namespace_packages": true,
            "namespace_packages": [],
            "follow_links": true,
            "indented_import_headings": true,
            "honor_case_in_force_sorted_sections": false,
            "sort_relative_in_force_sorted_sections": false,
            "overwrite_in_place": false,
            "reverse_sort": false,
            "star_first": false,
            "git_ignore": {},
            "format_error": "{error}: {message}",
            "format_success": "{success}: {message}",
            "sort_order": "natural",
            "source": "defaults"
        }
    ],
    "virtual_env": "",
    "conda_env": "",
    "ensure_newline_before_comments": false,
    "directory": "/home/buda/code/py/projectdir",
    "profile": "",
    "honor_noqa": false,
    "src_paths": [
        "/home/buda/code/py/projectdir/src",
        "/home/buda/code/py/projectdir"
    ],
    "old_finders": false,
    "remove_redundant_aliases": false,
    "float_to_top": false,
    "filter_files": false,
    "formatter": "",
    "formatting_function": null,
    "color_output": false,
    "treat_comments_as_code": [],
    "treat_all_comments_as_code": false,
    "supported_extensions": [
        "pyi",
        "pyx",
        "py",
        "pxd"
    ],
    "blocked_extensions": [
        "pex"
    ],
    "constants": [],
    "classes": [],
    "variables": [],
    "dedup_headings": false,
    "only_sections": false,
    "only_modified": false,
    "combine_straight_imports": false,
    "auto_identify_namespace_packages": true,
    "namespace_packages": [],
    "follow_links": true,
    "indented_import_headings": true,
    "honor_case_in_force_sorted_sections": false,
    "sort_relative_in_force_sorted_sections": false,
    "overwrite_in_place": false,
    "reverse_sort": false,
    "star_first": false,
    "git_ignore": {},
    "format_error": "{error}: {message}",
    "format_success": "{success}: {message}",
    "sort_order": "natural"

Originally posted by @SandroJijavadze in #53 (comment)

Can both isort and black run on save?

Thanks for your work on this! Using the config from the readme (copied below for reference) I need to save the file I'm working on twice. The first time isort fixes import order, and the second time black runs. Is it possible to get them both to run in one go?

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

How to only execute isort without executing any other organizeImports provider?

When I enable organizeImports, the code starts dancing on every save.

82044600-ebee6800-96ad-11ea-8da6-9e019d567c18

That is the line of code:

from transform_data import (preprocess_continous_image, transform_image_parallelized,
                            weighted_majority_resampling)

My config:

"[python]": {
    "editor.formatOnSave": true,
    "editor.codeActionsOnSave": {
      "source.organizeImports": true
    }
  },
  "python.formatting.provider": "yapf",
  "python.formatting.yapfArgs": [
    "--style",
    "{based_on_style: google, column_limit: 100}"
  ],

In 15. May 2020 I already reported this here: microsoft/vscode#83586 (comment)

One conclusion seems to be that one currently cannot choose what organizeImports provider one actually wants to run and there is more than just isort running (microsoft/vscode#90221).

Since this was ignored previously, how can I just run isort without running anything else to avoid the above issue?

--skip-glob argument raises exception when opening a skipped file

Hi!

When adding a --skip-glob argument to skip files inside a folder, the extension raises the following exception while opening a skipped file:

isort --profile black --sg */migrations/* --ca --check --filename /home/username/Documents/repos/app-name/backend/api/migrations/0009_migration_name_.py -
CWD Formatter: /home/username/Documents/repos/app-name
[Error - 4:48:28 PM] Traceback (most recent call last):
  File "/home/username/.vscode/extensions/ms-python.isort-2022.1.11301002/bundled/formatter/format_server.py", line 140, in _run
    result = utils.run_module(
  File "/home/username/.vscode/extensions/ms-python.isort-2022.1.11301002/bundled/formatter/utils.py", line 177, in run_module
    return _run_module(module, argv, use_stdin, source)
  File "/home/username/.vscode/extensions/ms-python.isort-2022.1.11301002/bundled/formatter/utils.py", line 162, in _run_module
    runpy.run_module(module, run_name="__main__")
  File "/usr/lib/python3.8/runpy.py", line 210, in run_module
    return _run_code(code, {}, init_globals, run_name, mod_spec)
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/username/.virtualenvs/app-name/lib/python3.8/site-packages/isort/__main__.py", line 3, in <module>
    main()
  File "/home/username/.virtualenvs/app-name/lib/python3.8/site-packages/isort/main.py", line 1119, in main
    incorrectly_sorted = not api.check_stream(
  File "/home/username/.virtualenvs/app-name/lib/python3.8/site-packages/isort/api.py", line 264, in check_stream
    changed: bool = sort_stream(
  File "/home/username/.virtualenvs/app-name/lib/python3.8/site-packages/isort/api.py", line 189, in sort_stream
    raise FileSkipSetting(content_source)
isort.exceptions.FileSkipSetting: /home/username/Documents/repos/app-name/backend/api/migrations/0009_migration_name_.py was skipped as it's listed in 'skip' setting or matches a glob in 'skip_glob' setting

Config used:

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

Even with the --filter-files setting I'm getting the same output.

Any workaround to prevent this exception to be raised? As the final behavior is just fine, the file is actually getting skipped, but it throws an error each time a skipped file is opened and saved.

Thanks and great job with this extension ๐Ÿ‘ ๐Ÿ‘

"Sort imports" has no effect

The imports are not sorted in any way.

I'm using the latest version of VSCode and python extensions on Windows 11.
I have tried with two environments, python 3.9.13 and 3.10.6, freshly installed from conda forge.
I have tried Python Refactor: Sort imports from the command palette.
I have tried adding the following settings to settings.json:

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

(The black formatter works properly.)
I'm not sure what else I can try.

isort formatting error

Unable to use isort extension. always facing the following error when reload the windows

Formatting error, please see Output > isort for more info: Traceback (most recent call last): File "c:\Users\user\.vscode\extensions\ms-python.isort-2022.1.11261002\bundled\formatter\format_server.py", line 140, in _run result = utils.run_module( File "c:\Users\user\.vscode\extensions\ms-python.isort-2022.1.11261002\bundled\formatter\utils.py", line 177, in run_module return _run_module(module, argv, use_stdin, source) File "c:\Users\user\.vscode\extensions\ms-python.isort-2022.1.11261002\bundled\formatter\utils.py", line 162, in _run_module runpy.run_module(module, run_name="__main__") File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 212, in run_module return _run_code(code, {}, init_globals, run_name, mod_spec) File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code exec(code, run_globals) File "c:\Users\user\.vscode\extensions\ms-python.isort-2022.1.112610...

Settings:

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

`isort` does not pickup configuration when it is not in current working directory

Hi, it seems since updated to VSCode 1.73, the import sort order that gets autosaved has changed.

This is what my import sort used to be:
image

Now, when I hit save, this is what it changes to:
image

Here is our settings.json:

{
  "[typescriptreact]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "editor.formatOnSave": true,
  "files.exclude": {
    "**/__pycache__": true
  },
  "files.eol": "\n",
  "explorer.compactFolders": false,
  "[python]": {
    "editor.codeActionsOnSave": {
      "source.organizeImports": true
    }
  },
  "python.formatting.provider": "black",
  "python.testing.pytestEnabled": true,
  "python.testing.unittestArgs": ["-v", "-s", ".", "-p"],
  "python.testing.cwd": "pipeline",
  "jupyter.kernels.filter": [
  
  ],
  "window.zoomLevel": 1,
}

pyproject.toml:

[tool.poetry]
name = "pipeline"
version = "0.1.0"
description = ""
authors = ["achen187 <[email protected]>"]

[tool.poetry.dependencies]
python = "^3.9"
dagster = "0.13.8"
dagit = "0.13.8"
pandas = "^1.3.5"
pyproj = "^3.3.0"
pyshp = "^2.1.3"
networkx = "^2.6.3"
Shapely = "1.7.1"
pandera = "^0.8.1"
openpyxl = "^3.0.9"
xlwt = "^1.3.0"
xlrd = "^2.0.1"

[tool.poetry.dev-dependencies]
pytest = "^6.2.5"
pytest-mockito = "^0.0.4"
black = "^21.12b0"
flake8 = "^4.0.1"
isort = "^5.10.1"
autoflake = "^1.4"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.pytest.ini_options]
minversion = "6.0"
testpaths = [
    "pipeline_tests",
]
addopts = "-ra --basetemp=pipeline_tests/tmp_test_data"

[tool.isort]
profile = "black"

When I run
/Users/andychen/dev/nira-data-pipeline/pipeline/.venv/bin/python -m isort ./
It goes back to the original sort order I'm expecting.

So it seems like the new Isort mechanism isn't actually using the same command as my manual call?

I then tried to change the setting: "isort.importStrategy": "fromEnvironment"
but then that actually crashed the iSort server.

TypeError: stop_all_processes() missing 1 required positional argument: 'self'
[Info  - 4:04:54 PM] Connection to server got closed. Server will restart.
Traceback (most recent call last):
  File "/Users/andychen/.vscode/extensions/ms-python.isort-2022.4.0/bundled/tool/server.py", line 41, in <module>
    from pygls import lsp, protocol, server, uris, workspace
  File "/Users/andychen/.vscode/extensions/ms-python.isort-2022.4.0/bundled/libs/pygls/lsp/__init__.py", line 23, in <module>
    from pygls.lsp.types import *
  File "/Users/andychen/.vscode/extensions/ms-python.isort-2022.4.0/bundled/libs/pygls/lsp/types/__init__.py", line 2, in <module>
    from pygls.lsp.types.basic_structures import *
  File "/Users/andychen/.vscode/extensions/ms-python.isort-2022.4.0/bundled/libs/pygls/lsp/types/basic_structures.py", line 30, in <module>
    from pydantic import BaseModel, root_validator
  File "/Users/andychen/.vscode/extensions/ms-python.isort-2022.4.0/bundled/libs/pydantic/__init__.py", line 2, in <module>
    from . import dataclasses
  File "/Users/andychen/.vscode/extensions/ms-python.isort-2022.4.0/bundled/libs/pydantic/dataclasses.py", line 52, in <module>
    from typing_extensions import dataclass_transform
ImportError: cannot import name 'dataclass_transform' from 'typing_extensions' (/Users/andychen/dev/nira-data-pipeline/pipeline/.venv/lib/python3.9/site-packages/typing_extensions.py)
Error in atexit._run_exitfuncs:
TypeError: stop_all_processes() missing 1 required positional argument: 'self'
[Error - 4:04:54 PM] Connection to server got closed. Server will not be restarted.

--verbose command passed to isort via pyproject.toml or command line causes sorting to fail

If --verbose is passed to isort the output of the verbose isort command ends up in the file instead of the transformed sort order

If I choose quick fix with a file containing the below:

import asyncio
from typing import List
import uvicorn
from aiokafka import AIOKafkaProducer
from fastapi import File, UploadFile

The sorted imports turn into

else-type place_module for asyncio returned STDLIB
from-type place_module for typing returned STDLIB
else-type place_module for uvicorn returned THIRDPARTY
from-type place_module for aiokafka returned THIRDPARTY
from-type place_module for fastapi returned THIRDPARTY
import asyncio
from typing import List

from aiokafka import AIOKafkaProducer
from fastapi import File, UploadFile
import uvicorn

This is the isort command with --verbose


                 _                 _
                (_) ___  ___  _ __| |_
                | |/ _/ / _ \/ '__  _/
                | |\__ \/\_\/| |  | |_
                |_|\___/\___/\_/   \_/

      isort your imports, so you don't have to.

                    VERSION 5.10.1

from-type place_module for typing returned STDLIB
else-type place_module for uvicorn returned THIRDPARTY
from-type place_module for aiokafka returned THIRDPARTY
from-type place_module for fastapi returned THIRDPARTY
Fixing /Users/mt/Projects/isort_tests/test_isort/test_isort/test.py

`python.linting.cwd`-equivalent setting for new extensions

Hi, I have a monorepo workspace where the Python portion (including config files like pyproject.toml, isort.cfg, .flake8) is within a subdirectory (for example, ${workspaceRoot}/python/).

With the previous all-in-one behavior of the Python extension, I could set python.linting.cwd and all of these tools (black, flake8, isort, mypy, etc.) would pick up their configuration files appropriately.

With the new independent LSP extensions (I didn't want to clutter the repos, but this applies to the Black and Flake8 extensions as well), I can't find a way to set the cwd that linters run in. In the output panel, they always appear to run from the root of the repo.

For some of these tools, I might be able to pass an argument to override the config file to an absolute path, like "isort.args":["--settings-file", "python/pyproject.toml"], but the command-line flag to specify an explicit settings file is different for each tool, and sometimes weird behavior is observed when not run from the expected cwd (for example, a flake8 plugin I'm using doesn't work with the --config argument). Ideally, I'd like there to be a configurable cwd setting for each of these new extensions.

Formatting error unrecognized arguments: -

I am also facing the issue, without installing isort into the python environment. I am using v2022.1.11541002 of the extension.

isort --profile black --filename /Users/foo/repos/lambda-algorand-api/app.py -
CWD Formatter: /Users/foo/repos/lambda-algorand-api
[Error - 12:13:38 PM] usage: isort [-h] [-V] [--vn] [-v] [--only-modified] [--dedup-headings] [-q]
             [-d] [--overwrite-in-place] [--show-config] [--show-files] [--df]
             [-c] [--ws] [--sp SETTINGS_PATH] [--cr CONFIG_ROOT]
             [--resolve-all-configs] [--profile PROFILE] [--old-finders]
             [-j [JOBS]] [--ac] [--interactive] [--format-error FORMAT_ERROR]
             [--format-success FORMAT_SUCCESS] [--filter-files] [-s SKIP]
             [--extend-skip EXTEND_SKIP] [--sg SKIP_GLOB]
             [--extend-skip-glob EXTEND_SKIP_GLOB] [--gitignore]
             [--ext SUPPORTED_EXTENSIONS]
             [--blocked-extension BLOCKED_EXTENSIONS] [--dont-follow-links]
             [--filename FILENAME] [--allow-root] [-a ADD_IMPORTS] [--append]
             [--af] [--rm REMOVE_IMPORTS] [--float-to-top]
             [--dont-float-to-top] [--ca] [--cs] [-e] [--ff]
             [--fgw [FORCE_GRID_WRAP]] [-i INDENT]
             [--lbi LINES_BEFORE_IMPORTS] [--lai LINES_AFTER_IMPORTS]
             [--lbt LINES_BETWEEN_TYPES] [--le LINE_ENDING] [--ls] [--lss]
             [-m {GRID,VERTICAL,HANGING_INDENT,VERTICAL_HANGING_INDENT,VERTICAL_GRID,VERTICAL_GRID_GROUPED,VERTICAL_GRID_GROUPED_NO_COMMA,NOQA,VERTICAL_HANGING_INDENT_BRACKET,VERTICAL_PREFIX_FROM_MODULE_IMPORT,HANGING_INDENT_WITH_PARENTHESES,BACKSLASH_GRID,0,1,2,3,4,5,6,7,8,9,10,11}]
             [-n] [--nis] [--ot] [--dt] [--rr] [--reverse-sort]
             [--sort-order SORT_ORDER] [--sl] [--nsl SINGLE_LINE_EXCLUSIONS]
             [--tc] [--up] [-l LINE_LENGTH] [--wl WRAP_LENGTH]
             [--case-sensitive] [--remove-redundant-aliases] [--honor-noqa]
             [--treat-comment-as-code TREAT_COMMENTS_AS_CODE]
             [--treat-all-comment-as-code] [--formatter FORMATTER] [--color]
             [--ext-format EXT_FORMAT] [--star-first] [--sd DEFAULT_SECTION]
             [--only-sections] [--ds] [--fas] [--fss] [--hcss] [--srss]
             [--fass] [-t FORCE_TO_TOP] [--combine-straight-imports]
             [--nlb NO_LINES_BEFORE] [--src SRC_PATHS]
             [-b KNOWN_STANDARD_LIBRARY]
             [--extra-builtin EXTRA_STANDARD_LIBRARY]
             [-f KNOWN_FUTURE_LIBRARY] [-o KNOWN_THIRD_PARTY]
             [-p KNOWN_FIRST_PARTY] [--known-local-folder KNOWN_LOCAL_FOLDER]
             [--virtual-env VIRTUAL_ENV] [--conda-env CONDA_ENV]
             [--py {all,2,27,3,310,35,36,37,38,39,auto}]
             [files ...]
isort: error: unrecognized arguments: -

I sort lints just fine, but when attempting to sort imports it fails with the above error.

Originally posted by @juls858 in #56 (comment)

TypeError: Cannot read properties of null (reading 'map')

[2022-06-21 10:42:13.425] [renderer1] [error] Cannot read properties of null (reading 'map'): TypeError: Cannot read properties of null (reading 'map')
	at g (/home/buda/.vscode/extensions/ms-python.isort-2022.3.11671003/dist/extension.js:1:213014)
	at Object.asCodeAction (/home/buda/.vscode/extensions/ms-python.isort-2022.3.11671003/dist/extension.js:1:223954)
	at /home/buda/.vscode/extensions/ms-python.isort-2022.3.11671003/dist/extension.js:1:152688
	at async U.provideCodeActions (/opt/visual-studio-code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:83:103131)

Filed by @SandroJijavadze here #53 (comment)

The isort server crashed 5 times in the last 3 minutes. The server will not be restarted.

Type: Bug

Not sure what is causing the problem.

Log

Traceback (most recent call last):
  File "/home/scarf/.vscode/extensions/ms-python.isort-2022.3.12911018/bundled/tool/server.py", line 41, in <module>
    from pygls import lsp, protocol, server, uris, workspace
  File "/home/scarf/.vscode/extensions/ms-python.isort-2022.3.12911018/bundled/libs/pygls/lsp/__init__.py", line 23, in <module>
    from pygls.lsp.types import *
  File "/home/scarf/.vscode/extensions/ms-python.isort-2022.3.12911018/bundled/libs/pygls/lsp/types/__init__.py", line 6, in <module>
    from pygls.lsp.types.general_messages import *
  File "/home/scarf/.vscode/extensions/ms-python.isort-2022.3.12911018/bundled/libs/pygls/lsp/types/general_messages.py", line 35, in <module>
    from pygls.lsp.types.language_features import (CallHierarchyClientCapabilities,
  File "/home/scarf/.vscode/extensions/ms-python.isort-2022.3.12911018/bundled/libs/pygls/lsp/types/language_features/__init__.py", line 2, in <module>
    from pygls.lsp.types.language_features.call_hierarchy import *
  File "/home/scarf/.vscode/extensions/ms-python.isort-2022.3.12911018/bundled/libs/pygls/lsp/types/language_features/call_hierarchy.py", line 70, in <module>
    class CallHierarchyIncomingCall(Model):
  File "/home/scarf/.vscode/extensions/ms-python.isort-2022.3.12911018/bundled/libs/pydantic/main.py", line 292, in __new__
    cls.__signature__ = ClassAttribute('__signature__', generate_model_signature(cls.__init__, fields, config))
                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/scarf/.vscode/extensions/ms-python.isort-2022.3.12911018/bundled/libs/pydantic/utils.py", line 258, in generate_model_signature
    merged_params[param_name] = Parameter(
                                ^^^^^^^^^^
  File "/home/scarf/.asdf/installs/python/3.11.0rc2/lib/python3.11/inspect.py", line 2715, in __init__
    raise ValueError('{!r} is not a valid parameter name'.format(name))
ValueError: 'from' is not a valid parameter name
Exception ignored in atexit callback: <function ProcessManager.stop_all_processes at 0x7ffa70a45800>
TypeError: ProcessManager.stop_all_processes() missing 1 required positional argument: 'self'
[Info  - ์˜ค์ „ 10:55:50] Connection to server got closed. Server will restart.

Extension version: 2022.3.12931038
VS Code version: Code 1.72.2 (d045a5eda657f4d7b676dedbfa7aab8207f8a075, 2022-10-12T22:16:26.920Z)
OS version: Linux x64 5.15.0-52-generic
Modes:
Sandboxed: No

System Info
Item Value
CPUs AMD Ryzen 7 4700U with Radeon Graphics (8 x 2000)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: disabled_software
video_encode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
Load (avg) 1, 1, 1
Memory (System) 30.72GB (23.06GB free)
Process Argv --unity-launch --crash-reporter-id b0fe70dc-73b5-44f5-a8cc-3807703c7d9c
Screen Reader no
VM 0%
DESKTOP_SESSION plasma
XDG_CURRENT_DESKTOP KDE
XDG_SESSION_DESKTOP KDE
XDG_SESSION_TYPE x11
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492:30256859
vslsvsres303:30308271
pythonvspyl392:30443607
vserr242cf:30382550
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscoreces:30445986
pythondataviewer:30285071
vscod805:30301674
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
cmake_vspar411:30581797
vsaa593cf:30376535
pythonvs932:30410667
cppdebug:30492333
vsclangdc:30486549
c4g48928:30535728
dsvsc012:30540252
azure-dev_surveyone:30548225
i497e931:30553904
pyindex848:30577860
nodejswelcome1:30587005
40g7c324:30573242

Providing path to an external isort is breaking formatting

To mitigate formatting issues that I have reported in #53 I was trying to use adequate, default, known, healthy, community-supported isort.

VScode settings:

"isort.path": ["/usr/local/bin/isort"],
"isort.args": [
    "--profile",
    "black",
    "--line-length",
    "99",
    "--skip-gitignore"
],

Output errors that I get. isort somehow dublicates arguments and passing the stuff:

/usr/local/bin/isort --profile black --line-length 99 --skip-gitignore --check --filename /Users/den/work/sky/projects/webapi/browser.py -
CWD Formatter: /Users/den/work/sky/projects
/usr/local/bin/isort --profile black --line-length 99 --skip-gitignore --check --filename /Users/den/work/sky/projects/webapi/browser.py - --profile black --line-length 99 --skip-gitignore --filename /Users/den/work/sky/projects/webapi/browser.py -
CWD Formatter: /Users/den/work/sky/projects
[Error - 1:56:05 PM] usage: isort [-h] [-V] [--vn] [-v] [--only-modified] [--dedup-headings] [-q]
             [-d] [--overwrite-in-place] [--show-config] [--show-files] [--df]
             [-c] [--ws] [--sp SETTINGS_PATH] [--cr CONFIG_ROOT]
             [--resolve-all-configs] [--profile PROFILE] [--old-finders]
             [-j [JOBS]] [--ac] [--interactive] [--format-error FORMAT_ERROR]
             [--format-success FORMAT_SUCCESS] [--filter-files] [-s SKIP]
             [--extend-skip EXTEND_SKIP] [--sg SKIP_GLOB]
             [--extend-skip-glob EXTEND_SKIP_GLOB] [--gitignore]
             [--ext SUPPORTED_EXTENSIONS]
             [--blocked-extension BLOCKED_EXTENSIONS] [--dont-follow-links]
             [--filename FILENAME] [--allow-root] [-a ADD_IMPORTS] [--append]
             [--af] [--rm REMOVE_IMPORTS] [--float-to-top]
             [--dont-float-to-top] [--ca] [--cs] [-e] [--ff]
             [--fgw [FORCE_GRID_WRAP]] [-i INDENT]
             [--lbi LINES_BEFORE_IMPORTS] [--lai LINES_AFTER_IMPORTS]
             [--lbt LINES_BETWEEN_TYPES] [--le LINE_ENDING] [--ls] [--lss]
             [-m {GRID,VERTICAL,HANGING_INDENT,VERTICAL_HANGING_INDENT,VERTICAL_GRID,VERTICAL_GRID_GROUPED,VERTICAL_GRID_GROUPED_NO_COMMA,NOQA,VERTICAL_HANGING_INDENT_BRACKET,VERTICAL_PREFIX_FROM_MODULE_IMPORT,HANGING_INDENT_WITH_PARENTHESES,BACKSLASH_GRID,0,1,2,3,4,5,6,7,8,9,10,11}]
             [-n] [--nis] [--ot] [--dt] [--rr] [--reverse-sort]
             [--sort-order SORT_ORDER] [--sl] [--nsl SINGLE_LINE_EXCLUSIONS]
             [--tc] [--up] [-l LINE_LENGTH] [--wl WRAP_LENGTH]
             [--case-sensitive] [--remove-redundant-aliases] [--honor-noqa]
             [--treat-comment-as-code TREAT_COMMENTS_AS_CODE]
             [--treat-all-comment-as-code] [--formatter FORMATTER] [--color]
             [--ext-format EXT_FORMAT] [--star-first] [--sd DEFAULT_SECTION]
             [--only-sections] [--ds] [--fas] [--fss] [--hcss] [--srss]
             [--fass] [-t FORCE_TO_TOP] [--combine-straight-imports]
             [--nlb NO_LINES_BEFORE] [--src SRC_PATHS]
             [-b KNOWN_STANDARD_LIBRARY]
             [--extra-builtin EXTRA_STANDARD_LIBRARY]
             [-f KNOWN_FUTURE_LIBRARY] [-o KNOWN_THIRD_PARTY]
             [-p KNOWN_FIRST_PARTY] [--known-local-folder KNOWN_LOCAL_FOLDER]
             [--virtual-env VIRTUAL_ENV] [--conda-env CONDA_ENV]
             [--py {all,2,27,3,310,35,36,37,38,39,auto}]
             [files ...]
isort: error: unrecognized arguments: -

/usr/local/bin/isort --profile black --line-length 99 --skip-gitignore --check --filename /Users/den/work/sky/projects/webapi/browser.py - --profile black --line-length 99 --skip-gitignore --filename /Users/den/work/sky/projects/webapi/browser.py - --profile black --line-length 99 --skip-gitignore --filename /Users/den/work/sky/projects/webapi/browser.py -
CWD Formatter: /Users/den/work/sky/projects
[Error - 1:56:05 PM] usage: isort [-h] [-V] [--vn] [-v] [--only-modified] [--dedup-headings] [-q]
             [-d] [--overwrite-in-place] [--show-config] [--show-files] [--df]
             [-c] [--ws] [--sp SETTINGS_PATH] [--cr CONFIG_ROOT]
             [--resolve-all-configs] [--profile PROFILE] [--old-finders]
             [-j [JOBS]] [--ac] [--interactive] [--format-error FORMAT_ERROR]
             [--format-success FORMAT_SUCCESS] [--filter-files] [-s SKIP]
             [--extend-skip EXTEND_SKIP] [--sg SKIP_GLOB]
             [--extend-skip-glob EXTEND_SKIP_GLOB] [--gitignore]
             [--ext SUPPORTED_EXTENSIONS]
             [--blocked-extension BLOCKED_EXTENSIONS] [--dont-follow-links]
             [--filename FILENAME] [--allow-root] [-a ADD_IMPORTS] [--append]
             [--af] [--rm REMOVE_IMPORTS] [--float-to-top]
             [--dont-float-to-top] [--ca] [--cs] [-e] [--ff]
             [--fgw [FORCE_GRID_WRAP]] [-i INDENT]
             [--lbi LINES_BEFORE_IMPORTS] [--lai LINES_AFTER_IMPORTS]
             [--lbt LINES_BETWEEN_TYPES] [--le LINE_ENDING] [--ls] [--lss]
             [-m {GRID,VERTICAL,HANGING_INDENT,VERTICAL_HANGING_INDENT,VERTICAL_GRID,VERTICAL_GRID_GROUPED,VERTICAL_GRID_GROUPED_NO_COMMA,NOQA,VERTICAL_HANGING_INDENT_BRACKET,VERTICAL_PREFIX_FROM_MODULE_IMPORT,HANGING_INDENT_WITH_PARENTHESES,BACKSLASH_GRID,0,1,2,3,4,5,6,7,8,9,10,11}]
             [-n] [--nis] [--ot] [--dt] [--rr] [--reverse-sort]
             [--sort-order SORT_ORDER] [--sl] [--nsl SINGLE_LINE_EXCLUSIONS]
             [--tc] [--up] [-l LINE_LENGTH] [--wl WRAP_LENGTH]
             [--case-sensitive] [--remove-redundant-aliases] [--honor-noqa]
             [--treat-comment-as-code TREAT_COMMENTS_AS_CODE]
             [--treat-all-comment-as-code] [--formatter FORMATTER] [--color]
             [--ext-format EXT_FORMAT] [--star-first] [--sd DEFAULT_SECTION]
             [--only-sections] [--ds] [--fas] [--fss] [--hcss] [--srss]
             [--fass] [-t FORCE_TO_TOP] [--combine-straight-imports]
             [--nlb NO_LINES_BEFORE] [--src SRC_PATHS]
             [-b KNOWN_STANDARD_LIBRARY]
             [--extra-builtin EXTRA_STANDARD_LIBRARY]
             [-f KNOWN_FUTURE_LIBRARY] [-o KNOWN_THIRD_PARTY]
             [-p KNOWN_FIRST_PARTY] [--known-local-folder KNOWN_LOCAL_FOLDER]
             [--virtual-env VIRTUAL_ENV] [--conda-env CONDA_ENV]
             [--py {all,2,27,3,310,35,36,37,38,39,auto}]
             [files ...]
isort: error: unrecognized arguments: - -

/usr/local/bin/isort --profile black --line-length 99 --skip-gitignore --check --filename /Users/den/work/sky/projects/webapi/browser.py - --profile black --line-length 99 --skip-gitignore --filename /Users/den/work/sky/projects/webapi/browser.py - --profile black --line-length 99 --skip-gitignore --filename /Users/den/work/sky/projects/webapi/browser.py - --profile black --line-length 99 --skip-gitignore --check --filename /Users/den/work/sky/projects/webapi/browser.py -
CWD Formatter: /Users/den/work/sky/projects

Add warning/notice or explicit error regarding args structure

It is very easy to encounter issues that are hard to debug by simply setting the isort args via the settings panel and thus not properly separating them (it is more intuitive to add "--profile black" than it is to add "--profile", "black", even though the latter makes sense once you start thinking about it).

In my case this lead to the following error:

ERROR: Filename override is intended only for stream (-) sorting.

The command seemed okay though:

python -m isort - --profile black 

It was only after I found #64 that I realized what my mistake had been. Before that I tried reinstalling the extension and meddling with every extension setting I could find.

These are the solutions I could think of:

Solution 1: add a warning/notice in the extension readme to inform users that this can lead to hard to debug errors.

Solution 2: raise an error if the argument contains a space

Show error if isort version is not compatible.

Hi. I'd like to use isort with Black formatter, also from VSC extension. As long as file is getting formatted by Black, import sorting fails. I'm using isort-2022.1.11441003 with ms-python.python-2022.7.11511005.

My settings:

{
    "python.linting.pylintEnabled": true,
    "python.linting.enabled": true,
    "[python]": {
        "editor.defaultFormatter": "ms-python.black-formatter",
        "editor.formatOnSave": true,
        "editor.codeActionsOnSave": {
            "source.organizeImports": true
        },
      },
      "black-formatter.args":["--line-length","120"],
      "isort.args":["--profile", "black"]
    
}

Output of isort extension:

isort --profile black --filename /home/p.niemiec/Repos/sca-research/datasets/convert_wav.py -
CWD Formatter: /home/p.niemiec/Repos/sca-research
[Error - 11:16:40 AM] usage: isort [-h] [--src SRC_PATHS] [-a ADD_IMPORTS] [--append] [--ac] [--af]
             [-b KNOWN_STANDARD_LIBRARY]
             [--extra-builtin EXTRA_STANDARD_LIBRARY] [-c] [--ca] [--cs] [-d]
             [--df] [--ds] [-e] [-f KNOWN_FUTURE_LIBRARY] [--fas] [--fass]
             [--ff FROM_FIRST] [--fgw [FORCE_GRID_WRAP]] [--fss] [-i INDENT]
             [-j JOBS] [--lai LINES_AFTER_IMPORTS] [--lbt LINES_BETWEEN_TYPES]
             [--le LINE_ENDING] [--ls] [--lss]
             [-m {GRID,VERTICAL,HANGING_INDENT,VERTICAL_HANGING_INDENT,VERTICAL_GRID,VERTICAL_GRID_GROUPED,VERTICAL_GRID_GROUPED_NO_COMMA,NOQA,VERTICAL_HANGING_INDENT_BRACKET,VERTICAL_PREFIX_FROM_MODULE_IMPORT,HANGING_INDENT_WITH_PARENTHESES,BACKSLASH_GRID,0,1,2,3,4,5,6,7,8,9,10,11}]
             [-n] [--nis] [--nlb NO_LINES_BEFORE] [-o KNOWN_THIRD_PARTY]
             [--ot] [--dt] [-p KNOWN_FIRST_PARTY]
             [--known-local-folder KNOWN_LOCAL_FOLDER] [-q]
             [--rm REMOVE_IMPORTS] [--rr] [-s SKIP] [--sd DEFAULT_SECTION]
             [--sg SKIP_GLOB] [--gitignore] [--sl]
             [--nsl SINGLE_LINE_EXCLUSIONS] [--sp SETTINGS_PATH]
             [-t FORCE_TO_TOP] [--tc] [--up] [-V] [-v]
             [--virtual-env VIRTUAL_ENV] [--conda-env CONDA_ENV] [--vn]
             [-l LINE_LENGTH] [--wl WRAP_LENGTH] [--ws] [--case-sensitive]
             [--filter-files] [--py {all,2,27,3,35,36,37,38,39,auto}]
             [--profile PROFILE] [--interactive] [--old-finders]
             [--show-config] [--show-files] [--honor-noqa]
             [--remove-redundant-aliases] [--color] [--float-to-top]
             [--treat-comment-as-code TREAT_COMMENTS_AS_CODE]
             [--treat-all-comment-as-code] [--formatter FORMATTER]
             [--ext SUPPORTED_EXTENSIONS]
             [--blocked-extension BLOCKED_EXTENSIONS] [--dedup-headings]
             [--only-sections] [--only-modified]
             [files [files ...]]
isort: error: unrecognized arguments: --filename

Ctrl+. doesn't work for isort Quick Fix

Testing microsoft/vscode-python#18997

  1. Follow the test plan instructions until you get the red squiggly under the first import.
  2. Put the cursor on the first import.
  3. Press Ctrl+. to show Quick Fixes.

"No code actions available" shown in hover

image

  1. Hover over first import so that you see the Problem text along with link to Quick Fix (Ctrl+.)

image

  1. Try Ctrl+.

Again "No code actions available" hover

Warnings in Developer Tools

console.ts:137 [Extension Host] stack trace: TypeError: Cannot read properties of undefined (reading 'uri')
    at u (c:\Users\brcan\.vscode-insiders\extensions\ms-python.isort-2022.3.11671003\dist\extension.js:1:70138)
    at l (c:\Users\brcan\.vscode-insiders\extensions\ms-python.isort-2022.3.11671003\dist\extension.js:1:70336)
    at t.restartFormatServer (c:\Users\brcan\.vscode-insiders\extensions\ms-python.isort-2022.3.11671003\dist\extension.js:1:70922)
    at f (c:\Users\brcan\.vscode-insiders\extensions\ms-python.isort-2022.3.11671003\dist\extension.js:1:302174)
    at c:\Users\brcan\.vscode-insiders\extensions\ms-python.isort-2022.3.11671003\dist\extension.js:1:302325 (at console.<anonymous> (c:\Users\brcan\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:85:93517))
  ERR Cannot read properties of undefined (reading 'uri'): TypeError: Cannot read properties of undefined (reading 'uri')
    at u (c:\Users\brcan\.vscode-insiders\extensions\ms-python.isort-2022.3.11671003\dist\extension.js:1:70138)
    at l (c:\Users\brcan\.vscode-insiders\extensions\ms-python.isort-2022.3.11671003\dist\extension.js:1:70336)
    at t.restartFormatServer (c:\Users\brcan\.vscode-insiders\extensions\ms-python.isort-2022.3.11671003\dist\extension.js:1:70922)
    at f (c:\Users\brcan\.vscode-insiders\extensions\ms-python.isort-2022.3.11671003\dist\extension.js:1:302174)
    at c:\Users\brcan\.vscode-insiders\extensions\ms-python.isort-2022.3.11671003\dist\extension.js:1:302325

Add support for yapf formatter

The example config in the README shows "isort.args": ["--profile", "black"] but we are using yapf as formatter.
I tried setting "yapf" here but then isort throws this error:

isort.exceptions.ProfileDoesNotExist: Specified profile of yapf does not exist. Available profiles: black,django,pycharm,google,open_stack,plone,attrs,hug,wemake,appnexus.

From this I take it that yapf is not yet supported.
I hope this can be added.

Keyboard focus is moved to end of file upon save in diff view

This seems to happen in diff views only, so to reproduce, create an empty Git repo, create a new file, and open it by double-clicking in Source Control.

Before saving:
image

After saving:
image

This does not happen with only the black extension installed:

Before:
image

After:
image

Missing Release Version

Hello! When I try to install this extension I get the following error:

Can't install release version of 'ms-python.isort' extension because it has no release version.

Error when saving an empty file.

When I want to save an empty file๏ผš

Saving 'draft.py': Getting code actions from ''Python', 'IntelliCode API Usage Examples', 'Jupyter', 'isort'' configure.

And I must restart VS Code after the 'Cancel'

My setting is like:

    "[python]": {
        "editor.formatOnSave": true,
        "editor.formatOnPaste": true,
        "editor.codeActionsOnSave": {
            "source.fixAll.eslint": true,
            "source.organizeImports": true
        },
    },
    "isort.args": [
        "--profile",
        "black"
    ],

New version crash on startup

I get this error now on latest VSCode release & latest extension version:

SyntaxError: future feature annotations is not defined
[Info  - 9:04:29 PM] Connection to server got closed. Server will restart.
  File "/home/gwebster/.vscode-server/extensions/ms-python.isort-2022.5.13061128/bundled/tool/server.py", line 4
    from __future__ import annotations

I don't think it's related to 3.11 as I'm not using that yet.

isort extension not working on remote container

Type: Bug

Behaviour

isort was working fine prior to being broken out into the new extension. now it doesn't work at all (no sorting).

Expected vs. Actual

I expect it to work, and it does nothing.

Steps to reproduce:

  1. Open a remote container (a docker container running on a remote server).
  2. Project has [tool:isort] config in setup.cfg

Diagnostic data

  • Python version (& distribution if applicable, e.g. Anaconda): 3.10.7
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Global
  • Value of the python.languageServer setting: Pylance
Output for Python in the Output panel (Viewโ†’Output, change the drop-down the upper-right of the Output panel to Python)

Experiment 'pythonaacf' is active
LSP Notebooks experiment is enabled
LSP Notebooks interactive window support is enabled
Python interpreter path: /usr/local/bin/python
Starting Pylance language server.
> conda info --json
Extension search path: /home/gidev/.vscode-server/extensions
> /usr/local/bin/python ~/.vscode-server/extensions/ms-python.python-2022.20.2/pythonFiles/get_output_via_markers.py ~/.vscode-server/extensions/ms-python.python-2022.20.2/pythonFiles/interpreterInfo.py
Extension search path: /home/gidev/.vscode-server/extensions
> /usr/local/bin/python ~/.vscode-server/extensions/ms-python.python-2022.20.2/pythonFiles/linter.py -m mypy --follow-imports=silent --ignore-missing-imports --show-column-numbers --no-pretty /cargo/api/public/graphql/resolve/query/post.py
cwd: /cargo/api
> /usr/local/bin/python ~/.vscode-server/extensions/ms-python.python-2022.20.2/pythonFiles/linter.py -m flake8 /cargo/api/public/graphql/resolve/query/post.py
cwd: /cargo/api
> /usr/local/bin/python ~/.vscode-server/extensions/ms-python.python-2022.20.2/pythonFiles/linter.py -m mypy --follow-imports=silent --ignore-missing-imports --show-column-numbers --no-pretty /cargo/api/public/graphql/resolve/query/post.py
cwd: /cargo/api
> /usr/local/bin/python ~/.vscode-server/extensions/ms-python.python-2022.20.2/pythonFiles/linter.py -m flake8 /cargo/api/public/graphql/resolve/query/post.py
cwd: /cargo/api
##########Linting Output - mypy##########


##########Linting Output - flake8##########


User Settings


languageServer: "Pylance"

linting
โ€ข flake8Enabled: true
โ€ข mypyEnabled: true

testing
โ€ข pytestEnabled: true

Extension version: 2022.8.0
VS Code version: Code 1.73.1 (6261075646f055b99068d3688932416f2346dd3b, 2022-11-09T02:22:48.959Z)
OS version: Darwin arm64 22.1.0
Modes:
Sandboxed: No
Remote OS version: Linux x64 4.14.262-200.489.amzn2.x86_64
Remote OS version: Linux x64 4.14.262-200.489.amzn2.x86_64
Connection to 'attached-container+7b22636f6e7461696e65724e616d65223a222f636172676f5f6f66666963655f31222c2273657474696e6773223a7b22636f6e74657874223a226d655f646576227d7d' could not be established

System Info
Item Value
CPUs Apple M1 Pro (8 x 24)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
Load (avg) 3, 2, 2
Memory (System) 16.00GB (0.05GB free)
Process Argv --crash-reporter-id 1ed310f7-1cef-41d4-acaa-253391dfe6c7
Screen Reader no
VM 0%
Item Value
Remote Container cargo-www (cargo_www_1) @ me_dev
OS Linux x64 4.14.262-200.489.amzn2.x86_64
CPUs AMD EPYC 7571 (4 x 2199)
Memory (System) 15.52GB (6.95GB free)
VM 0%
Item Value
Remote Container cargo-api (cargo_backend_1) @ me_dev
OS Linux x64 4.14.262-200.489.amzn2.x86_64
CPUs AMD EPYC 7571 (4 x 2199)
Memory (System) 15.52GB (6.95GB free)
VM 0%

Connection to 'attached-container+7b22636f6e7461696e65724e616d65223a222f636172676f5f6f66666963655f31222c2273657474696e6773223a7b22636f6e74657874223a226d655f646576227d7d' could not be established

A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
pythonvspyl392:30443607
vserr242cf:30382550
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
pythondataviewer:30285071
vscod805:30301674
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
cmake_vspar411:30581797
vsaa593cf:30376535
pythonvs932:30410667
cppdebug:30492333
vsclangdf:30486550
c4g48928:30535728
dsvsc012:30540252
azure-dev_surveyone:30548225
pyindex848cf:30577861
nodejswelcome1cf:30587006
fc301958:30595537
2e4cg342:30602488
gswce1:30612156
3d0df643:30608728
dbltrim-noruby:30604474
89544117:30607850

Extension not support python < 3.10 because use future annotation format

its a problem for centos 7 where python is old version by default

Name: isort
Module: isort
Python extension loading
Waiting for interpreter from python extension.
Python extension loaded
  File "/root/.vscode-server/extensions/ms-python.isort-2022.9.13221008/bundled/tool/server.py", line 4
    from __future__ import annotations
    ^
SyntaxError: future feature annotations is not defined
[Info  - 1:44:10 PM] Connection to server got closed. Server will restart.
  File "/root/.vscode-server/extensions/ms-python.isort-2022.9.13221008/bundled/tool/server.py", line 4
    from __future__ import annotations
    ^
SyntaxError: future feature annotations is not defined
[Info  - 1:44:10 PM] Connection to server got closed. Server will restart.
  File "/root/.vscode-server/extensions/ms-python.isort-2022.9.13221008/bundled/tool/server.py", line 4
    from __future__ import annotations
    ^
SyntaxError: future feature annotations is not defined
[Info  - 1:44:10 PM] Connection to server got closed. Server will restart.
  File "/root/.vscode-server/extensions/ms-python.isort-2022.9.13221008/bundled/tool/server.py", line 4
    from __future__ import annotations
    ^
SyntaxError: future feature annotations is not defined
[Info  - 1:44:10 PM] Connection to server got closed. Server will restart.
  File "/root/.vscode-server/extensions/ms-python.isort-2022.9.13221008/bundled/tool/server.py", line 4
    from __future__ import annotations
    ^
SyntaxError: future feature annotations is not defined
[Error - 1:44:10 PM] Connection to server got closed. Server will not be restarted.
Traceback (most recent call last):
  File "/root/.vscode-server/extensions/ms-python.isort-2022.9.13221008/bundled/tool/server.py", line 40, in <module>
    import utils
  File "/root/.vscode-server/extensions/ms-python.isort-2022.9.13221008/bundled/tool/utils.py", line 4
    from __future__ import annotations
    ^
SyntaxError: future feature annotations is not defined
Error in atexit._run_exitfuncs:
TypeError: stop_all_processes() missing 1 required positional argument: 'self'
[Info  - 1:45:26 PM] Connection to server got closed. Server will restart.
Traceback (most recent call last):
  File "/root/.vscode-server/extensions/ms-python.isort-2022.9.13221008/bundled/tool/server.py", line 40, in <module>
    import utils
  File "/root/.vscode-server/extensions/ms-python.isort-2022.9.13221008/bundled/tool/utils.py", line 4
    from __future__ import annotations
    ^
SyntaxError: future feature annotations is not defined
Error in atexit._run_exitfuncs:
TypeError: stop_all_processes() missing 1 required positional argument: 'self'
[Info  - 1:45:27 PM] Connection to server got closed. Server will restart.
Traceback (most recent call last):
  File "/root/.vscode-server/extensions/ms-python.isort-2022.9.13221008/bundled/tool/server.py", line 40, in <module>
    import utils
  File "/root/.vscode-server/extensions/ms-python.isort-2022.9.13221008/bundled/tool/utils.py", line 4
    from __future__ import annotations
    ^
SyntaxError: future feature annotations is not defined
Error in atexit._run_exitfuncs:
TypeError: stop_all_processes() missing 1 required positional argument: 'self'
[Info  - 1:45:27 PM] Connection to server got closed. Server will restart.
Traceback (most recent call last):
  File "/root/.vscode-server/extensions/ms-python.isort-2022.9.13221008/bundled/tool/server.py", line 40, in <module>
    import utils
  File "/root/.vscode-server/extensions/ms-python.isort-2022.9.13221008/bundled/tool/utils.py", line 4
    from __future__ import annotations
    ^
SyntaxError: future feature annotations is not defined
Error in atexit._run_exitfuncs:
TypeError: stop_all_processes() missing 1 required positional argument: 'self'
[Info  - 1:45:27 PM] Connection to server got closed. Server will restart.
Traceback (most recent call last):
  File "/root/.vscode-server/extensions/ms-python.isort-2022.9.13221008/bundled/tool/server.py", line 40, in <module>
    import utils
  File "/root/.vscode-server/extensions/ms-python.isort-2022.9.13221008/bundled/tool/utils.py", line 4
    from __future__ import annotations
    ^
SyntaxError: future feature annotations is not defined
Error in atexit._run_exitfuncs:
TypeError: stop_all_processes() missing 1 required positional argument: 'self'
[Error - 1:45:27 PM] Connection to server got closed. Server will not be restarted.
Traceback (most recent call last):
  File "/root/.vscode-server/extensions/ms-python.isort-2022.9.13221008/bundled/tool/server.py", line 40, in <module>
    import utils
  File "/root/.vscode-server/extensions/ms-python.isort-2022.9.13221008/bundled/tool/utils.py", line 4
    from __future__ import annotations
    ^
SyntaxError: future feature annotations is not defined
Error in atexit._run_exitfuncs:
TypeError: stop_all_processes() missing 1 required positional argument: 'self'
[Info  - 1:47:39 PM] Connection to server got closed. Server will restart.
Traceback (most recent call last):
  File "/root/.vscode-server/extensions/ms-python.isort-2022.9.13221008/bundled/tool/server.py", line 40, in <module>
    import utils
  File "/root/.vscode-server/extensions/ms-python.isort-2022.9.13221008/bundled/tool/utils.py", line 4
    from __future__ import annotations
    ^
SyntaxError: future feature annotations is not defined
Error in atexit._run_exitfuncs:
TypeError: stop_all_processes() missing 1 required positional argument: 'self'
[Info  - 1:47:39 PM] Connection to server got closed. Server will restart.
Traceback (most recent call last):
  File "/root/.vscode-server/extensions/ms-python.isort-2022.9.13221008/bundled/tool/server.py", line 40, in <module>
    import utils
  File "/root/.vscode-server/extensions/ms-python.isort-2022.9.13221008/bundled/tool/utils.py", line 4
    from __future__ import annotations
    ^
SyntaxError: future feature annotations is not defined
Error in atexit._run_exitfuncs:
TypeError: stop_all_processes() missing 1 required positional argument: 'self'
[Info  - 1:47:40 PM] Connection to server got closed. Server will restart.
Traceback (most recent call last):
  File "/root/.vscode-server/extensions/ms-python.isort-2022.9.13221008/bundled/tool/server.py", line 40, in <module>
    import utils
  File "/root/.vscode-server/extensions/ms-python.isort-2022.9.13221008/bundled/tool/utils.py", line 4
    from __future__ import annotations
    ^
SyntaxError: future feature annotations is not defined
Error in atexit._run_exitfuncs:
TypeError: stop_all_processes() missing 1 required positional argument: 'self'
[Info  - 1:47:40 PM] Connection to server got closed. Server will restart.
Traceback (most recent call last):
  File "/root/.vscode-server/extensions/ms-python.isort-2022.9.13221008/bundled/tool/server.py", line 40, in <module>
    import utils
  File "/root/.vscode-server/extensions/ms-python.isort-2022.9.13221008/bundled/tool/utils.py", line 4
    from __future__ import annotations
    ^
SyntaxError: future feature annotations is not defined
Error in atexit._run_exitfuncs:
TypeError: stop_all_processes() missing 1 required positional argument: 'self'
[Error - 1:47:40 PM] Connection to server got closed. Server will not be restarted.
Traceback (most recent call last):
  File "/root/.vscode-server/extensions/ms-python.isort-2022.9.13221008/bundled/tool/server.py", line 40, in <module>
    import utils
  File "/root/.vscode-server/extensions/ms-python.isort-2022.9.13221008/bundled/tool/utils.py", line 177, in <module>
    source: str = None,
TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'
Error in atexit._run_exitfuncs:
TypeError: stop_all_processes() missing 1 required positional argument: 'self'
[Info  - 1:48:08 PM] Connection to server got closed. Server will restart.
Traceback (most recent call last):
  File "/root/.vscode-server/extensions/ms-python.isort-2022.9.13221008/bundled/tool/server.py", line 40, in <module>
    import utils
  File "/root/.vscode-server/extensions/ms-python.isort-2022.9.13221008/bundled/tool/utils.py", line 177, in <module>
    source: str = None,
TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'
Error in atexit._run_exitfuncs:
TypeError: stop_all_processes() missing 1 required positional argument: 'self'
[Info  - 1:48:08 PM] Connection to server got closed. Server will restart.
Traceback (most recent call last):
  File "/root/.vscode-server/extensions/ms-python.isort-2022.9.13221008/bundled/tool/server.py", line 40, in <module>
    import utils
  File "/root/.vscode-server/extensions/ms-python.isort-2022.9.13221008/bundled/tool/utils.py", line 177, in <module>
    source: str = None,
TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'
Error in atexit._run_exitfuncs:
TypeError: stop_all_processes() missing 1 required positional argument: 'self'
[Info  - 1:48:09 PM] Connection to server got closed. Server will restart.
Traceback (most recent call last):
  File "/root/.vscode-server/extensions/ms-python.isort-2022.9.13221008/bundled/tool/server.py", line 40, in <module>
    import utils
  File "/root/.vscode-server/extensions/ms-python.isort-2022.9.13221008/bundled/tool/utils.py", line 177, in <module>
    source: str = None,
TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'
Error in atexit._run_exitfuncs:
TypeError: stop_all_processes() missing 1 required positional argument: 'self'
[Info  - 1:48:09 PM] Connection to server got closed. Server will restart.
Traceback (most recent call last):
  File "/root/.vscode-server/extensions/ms-python.isort-2022.9.13221008/bundled/tool/server.py", line 40, in <module>
    import utils
  File "/root/.vscode-server/extensions/ms-python.isort-2022.9.13221008/bundled/tool/utils.py", line 177, in <module>
    source: str = None,
TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'
Error in atexit._run_exitfuncs:
TypeError: stop_all_processes() missing 1 required positional argument: 'self'
[Error - 1:48:09 PM] Connection to server got closed. Server will not be restarted.

Appears to leak memory

Type: Bug

I'm trying to use VSCode to edit Python code on a resource-constrained, older server (AMD Turion(tm) II Neo N40L, 6GB RAM). This has been working very well, until recently.

I've narrowed this down to the extensions/ms-python.isort-<version>/bundled/tool/server.py process; saving files with the current pre-release is excruciatingly slow and it has been eating up memory and using loads of CPU. Memory use starts low but as files get saved memory use creeps up and up, until the system runs out of memory and starts swapping. The preview release appears to be worse in this regard.

When I disable the extension, things become workable again.

Extension version: 2022.9.13221008
VS Code version: Code 1.73.1 (6261075646f055b99068d3688932416f2346dd3b, 2022-11-09T02:22:48.959Z)
OS version: Darwin arm64 21.6.0
Modes:
Sandboxed: No
Remote OS version: Linux x64 4.19.0-21-amd64

System Info
Item Value
CPUs Apple M1 Pro (10 x 24)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
Load (avg) 6, 6, 8
Memory (System) 32.00GB (0.07GB free)
Process Argv --crash-reporter-id 6ee26e67-256e-4593-8cbb-57e7fb562f53
Screen Reader no
VM 0%
Item Value
Remote SSH: parsel
OS Linux x64 4.19.0-21-amd64
CPUs AMD Turion(tm) II Neo N40L Dual-Core Processor (2 x 1500)
Memory (System) 5.70GB (0.29GB free)
VM 0%
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
pythonvspyl392:30443607
vserr242:30382549
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
pythondataviewer:30285071
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
cmake_vspar411:30581797
vsaa593cf:30376535
pythonvs932:30410667
cppdebug:30492333
vsclangdf:30486550
c4g48928:30535728
dsvsc012:30540252
azure-dev_surveyone:30548225
pyindex848cf:30577861
nodejswelcome1:30587005
fc301958:30595537
282f8724:30602487
gswce1:30612156
iaj6b796:30613358
dbltrim-noruby:30604474
f6dab269:30613381

python 3.11 support

The extension doesn't work in the python 3.11 version. It gives an error message. Please add python latest version support.

image

Enabling the extension makes save very slow

vscode Version: 1.73.1
python extension version: v2022.18.2
isort extension version: v2022.6.0

The extension makes saving files very slow (around 5 seconds).

This was not the experience when i was using the isort in the past with this config.

"[python]": {
        "editor.codeActionsOnSave": {
            "source.organizeImports": true,
        }
    }

also - i can't seem to find a way to use isort as i was doing before?

Warn with running with old settings from the Python extension

isort Output from VSCode:

CWD Server: c:\Users\Avasam\Documents\Git\typeshed
sys.path used to run Server:
   c:\Users\Avasam\.vscode\extensions\ms-python.isort-2022.8.0\bundled\tool
   C:\Program Files\Python39\python39.zip
   C:\Program Files\Python39\DLLs
   C:\Program Files\Python39\lib
   C:\Program Files\Python39
   c:\Users\Avasam\Documents\Git\typeshed\.venv
   c:\Users\Avasam\Documents\Git\typeshed\.venv\lib\site-packages
   c:\Users\Avasam\Documents\Git\typeshed\.venv\lib\site-packages\win32
   c:\Users\Avasam\Documents\Git\typeshed\.venv\lib\site-packages\win32\lib
   c:\Users\Avasam\Documents\Git\typeshed\.venv\lib\site-packages\Pythonwin
   c:\Users\Avasam\.vscode\extensions\ms-python.isort-2022.8.0\bundled\libs
Settings used to run Server:
[
    {
        "check": true,
        "workspace": "file:///c%3A/Users/Avasam/Documents/Git/typeshed",
        "logLevel": "error",
        "args": [
            "--line-length=120",
            "--combine-as"
        ],
        "severity": {
            "W": "Warning",
            "E": "Warning"
        },
        "path": [],
        "interpreter": [
            "c:\\Users\\Avasam\\Documents\\Git\\typeshed\\.venv\\Scripts\\python.exe"
        ],
        "importStrategy": "fromEnvironment",
        "showNotifications": "off"
    }
]

c:\Users\Avasam\Documents\Git\typeshed\.venv\Scripts\python.exe -m isort --version-number
CWD Linter: c:\Users\Avasam\Documents\Git\typeshed
Version info for isort running for c:\Users\Avasam\Documents\Git\typeshed:
5.10.1

SUPPORTED isort>=5.10.1
FOUND isort==5.10.1

c:\Users\Avasam\Documents\Git\typeshed\.venv\Scripts\python.exe -m isort - --line-length=120 --combine-as --check --filename c:\Users\Avasam\Documents\Git\typeshed\stubs\python-xlib\Xlib\protocol\rq.pyi
CWD Linter: c:\Users\Avasam\Documents\Git\typeshed
ERROR: c:\Users\Avasam\Documents\Git\typeshed\stubs\python-xlib\Xlib\protocol\rq.pyi Imports are incorrectly sorted and/or formatted.

Settings:
image

pyproject.toml :

[tool.isort]
profile = "black"
combine_as_imports = true
line_length = 130

isort in editor thinks lines are too long because they're over 120 chars. When the limit is 130:
image

isort crashed five times...

Whenever I start VSC on my Windows 10 Pro notebook and connect to a remote linux server via the remote-ssh extension I get the message shown in the screenshot below:

image

Even if it says that it crashed five times in the last three minutes, this message is shown as soon as VSC connects to the remote server. isort is version v2022.6.0.

I uninstalled all the Microsoft python extensions, deleted the folders ~/.vscode-server/extensions/ms-python.* and resintalled everything but the problem is still here.

Version: 1.73.1 (user setup)
Commit: 6261075646f055b99068d3688932416f2346dd3b
Date: 2022-11-09T04:27:29.066Z
Electron: 19.0.17
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Windows_NT x64 10.0.19043
Sandboxed: No

Cannot read properties of null

Testing microsoft/vscode-python#18997

I don't think I did anything really, maybe I clicked on the error shown in the editor:
image

ERR Cannot read properties of null (reading 'map'): TypeError: Cannot read properties of null (reading 'map')
	at g (c:\Users\alex\.vscode\extensions\ms-python.isort-2022.1.11161003\dist\extension.js:1:212940)
	at Object.asCodeAction (c:\Users\alex\.vscode\extensions\ms-python.isort-2022.1.11161003\dist\extension.js:1:223880)
	at c:\Users\alex\.vscode\extensions\ms-python.isort-2022.1.11161003\dist\extension.js:1:152614
	at async U.provideCodeActions (c:\Users\alex\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:85:100925)

[Error] isort got an unexpected arguments `--filename`

VScode version:

Version: 1.70.1
Commit: 6d9b74a70ca9c7733b29f0456fd8195364076dda
Date: 2022-08-10T06:09:15.055Z
Electron: 18.3.5
Chromium: 100.0.4896.160
Node.js: 16.13.2
V8: 10.0.139.17-electron.0
OS: Linux x64 5.4.0-132-generic

isort version: newest

isort config: empty

image

Error log:

image

Provider throwing errors on vscode 1.73.0

Since the newest vscode release I have had some issues getting the plugin to run correctly. From a clean plugin install I am seeing this in the extension host log on an m1 mac

2022-11-05 12:59:18.676 [error] [ms-python.isort] provider FAILED
2022-11-05 12:59:18.676 [error] TypeError: Cannot read properties of null (reading 'map')
	at g (/Users/mt/.vscode/extensions/ms-python.isort-2022.4.0/dist/extension.js:1:214932)
	at Object.asCodeAction (/Users/mt/.vscode/extensions/ms-python.isort-2022.4.0/dist/extension.js:1:225872)
	at /Users/mt/.vscode/extensions/ms-python.isort-2022.4.0/dist/extension.js:1:154586
	at async x.provideCodeActions (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:94:43007)

If I change the isort to use the environment's isort I get

2022-11-05 13:02:08.107 [error] TypeError: Cannot read properties of null (reading 'map')
	at g (/Users/mt/.vscode/extensions/ms-python.isort-2022.4.0/dist/extension.js:1:214932)
	at Object.asCodeAction (/Users/mt/.vscode/extensions/ms-python.isort-2022.4.0/dist/extension.js:1:225872)
	at /Users/mt/.vscode/extensions/ms-python.isort-2022.4.0/dist/extension.js:1:154586
	at async x.provideCodeActions (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:94:43007)
2022-11-05 13:02:08.895 [error] Error: write after end
	at new NodeError (node:internal/errors:371:5)
	at _write (node:internal/streams/writable:319:11)
	at Writable.write (node:internal/streams/writable:334:10)
	at /Users/mt/.vscode/extensions/ms-python.isort-2022.4.0/dist/extension.js:1:126879
	at new Promise (<anonymous>)
	at u.write (/Users/mt/.vscode/extensions/ms-python.isort-2022.4.0/dist/extension.js:1:126797)
	at m.doWrite (/Users/mt/.vscode/extensions/ms-python.isort-2022.4.0/dist/extension.js:1:116401)
	at /Users/mt/.vscode/extensions/ms-python.isort-2022.4.0/dist/extension.js:1:116296
	at runNextTicks (node:internal/process/task_queues:61:5)
	at process.processImmediate (node:internal/timers:437:9)

My settings.json

{
    "editor.formatOnSave": true,
    "[python]": {
        "editor.wordBasedSuggestions": false
    },
    "python.formatting.provider": "black",
    "isort.check": true,
}

unexpected error popped up

When I code at interactive window, the error message popped up.
image

version: v2022.3.12931038

setting

    "isort.logLevel": "warn",
    "isort.severity": {
        "W": "Information",
        "E": "Warning"
    },
    "isort.showNotifications": "onError",
    "isort.check": true

reproduce

example1

type

import numpy as np
??np.nan

output

[Error - 11:34:07 AM] Syntax error in code: Traceback (most recent call last):
  File "/home/wxz/.vscode/extensions/ms-python.isort-2022.3.12931038/bundled/tool/server.py", line 273, in is_python
    ast.parse(code)
  File "/home/wxz/Program/miniconda3/envs/seismic/lib/python3.10/ast.py", line 50, in parse
    return compile(source, filename, mode, flags,
  File "<unknown>", line 2
    ??np.nan
    ^
SyntaxError: invalid syntax

[Warn  - 11:34:07 AM] Skipping non python code: Interactive-1.interactive

example2

type !ls
output

[Warn  - 11:37:01 AM] Skipping non python code: Interactive-1.interactive
[Error - 11:38:43 AM] Syntax error in code: Traceback (most recent call last):
  File "/home/wxz/.vscode/extensions/ms-python.isort-2022.3.12931038/bundled/tool/server.py", line 273, in is_python
    ast.parse(code)
  File "/home/wxz/Program/miniconda3/envs/seismic/lib/python3.10/ast.py", line 50, in parse
    return compile(source, filename, mode, flags,
  File "<unknown>", line 1
    !ls
    ^
SyntaxError: invalid syntax

[Warn  - 11:38:43 AM] Skipping non python code: Interactive-1.interactive

extra, unexpected UnboundLocalError?

type import numpy as np
output

/home/wxz/Program/miniconda3/envs/seismic/bin/python -m isort - --profile black --check --filename Interactive-1.interactive
CWD Linter: /home/wxz/Work/MoXi/noise/NoiseCorr
[Warn  - 11:39:59 AM] Traceback (most recent call last):
  File "/home/wxz/.vscode/extensions/ms-python.isort-2022.3.12931038/bundled/tool/server.py", line 556, in _run_tool_on_document
    result = utils.run_module(
  File "/home/wxz/.vscode/extensions/ms-python.isort-2022.3.12931038/bundled/tool/utils.py", line 141, in run_module
    return _run_module(module, argv, use_stdin, source)
  File "/home/wxz/.vscode/extensions/ms-python.isort-2022.3.12931038/bundled/tool/utils.py", line 126, in _run_module
    runpy.run_module(module, run_name="__main__")
  File "/home/wxz/Program/miniconda3/envs/seismic/lib/python3.10/runpy.py", line 227, in run_module
    return _run_code(code, {}, init_globals, run_name, mod_spec)
  File "/home/wxz/Program/miniconda3/envs/seismic/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/wxz/.vscode/extensions/ms-python.isort-2022.3.12931038/bundled/libs/isort/__main__.py", line 3, in <module>
    main()
  File "/home/wxz/.vscode/extensions/ms-python.isort-2022.3.12931038/bundled/libs/isort/main.py", line 1119, in main
    incorrectly_sorted = not api.check_stream(
  File "/home/wxz/.vscode/extensions/ms-python.isort-2022.3.12931038/bundled/libs/isort/api.py", line 264, in check_stream
    changed: bool = sort_stream(
  File "/home/wxz/.vscode/extensions/ms-python.isort-2022.3.12931038/bundled/libs/isort/api.py", line 189, in sort_stream
    raise FileSkipSetting(content_source)
isort.exceptions.FileSkipSetting: Interactive-1.interactive was skipped as it's listed in 'skip' setting or matches a glob in 'skip_glob' setting

[Error - 11:39:59 AM] isort check failed with error:
Traceback (most recent call last):
  File "/home/wxz/.vscode/extensions/ms-python.isort-2022.3.12931038/bundled/tool/server.py", line 100, in _linting_helper
    result = _run_tool_on_document(document, use_stdin=True, extra_args=["--check"])
  File "/home/wxz/.vscode/extensions/ms-python.isort-2022.3.12931038/bundled/tool/server.py", line 569, in _run_tool_on_document
    if result.stderr:
UnboundLocalError: local variable 'result' referenced before assignment

Quick Fix suggestion/bulb keeps showing even if all imports sorted or no imports present

Type: Bug

  1. Open a new Python file; even Ctrl+N followed by Ctrl+K M and setting the language to Python suffices.
  2. Type print("there's a bug somewhere"), or any other valid Python code for that matter.
  3. The "Quick Fix bulb" shows up and suggests fixing import sorting/formatting with isort. Even after invoking the "fix" it disappears for a second and comes back again.

Peek 2022-11-11 14-59

This also happend in Jupyter notebooks where it's even more intrusive: there every cell separately gets the above treatment resulting in dozens of bulbs hanging around all over the place.

Extension version: 2022.6.0
VS Code version: Code 1.73.1 (6261075646f055b99068d3688932416f2346dd3b, 2022-11-09T03:54:53.913Z)
OS version: Linux x64 5.15.0-52-generic
Modes:
Sandboxed: No
Remote OS version: Linux x64 5.15.0-46-generic

System Info
Item Value
CPUs Intel(R) Core(TM) i5-7500T CPU @ 2.70GHz (4 x 3154)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: disabled_software
video_encode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
Load (avg) 1, 1, 1
Memory (System) 7.63GB (2.66GB free)
Process Argv -n --crash-reporter-id 19264bd0-28fa-49c3-b592-4ad556e17f7b
Screen Reader no
VM 0%
DESKTOP_SESSION ubuntu
XDG_CURRENT_DESKTOP Unity
XDG_SESSION_DESKTOP ubuntu
XDG_SESSION_TYPE x11
Item Value
Remote SSH
OS Linux x64 5.15.0-46-generic
CPUs Intel(R) Core(TM) i9-7940X CPU @ 3.10GHz (28 x 3499)
Memory (System) 62.51GB (55.86GB free)
VM 0%
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
pythonvspyl392:30443607
vserr242cf:30382550
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscoreces:30445986
pythondataviewer:30285071
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
cmake_vspar411:30581797
vsaa593:30376534
pythonvs932:30410667
cppdebug:30492333
vsclangdf:30486550
c4g48928:30535728
dsvsc012cf:30540253
azure-dev_surveyone:30548225
pyindex848cf:30577861
nodejswelcome1cf:30587006
fc301958:30595537
2e4cg342:30602488
gswce1:30605430
3d0df643:30608728
dbltrim-noruby:30604474
89544117:30607850

Isort ignores --resolve-all-configs

As title mentions it completely ignores any nested config file, in my case setup.cfg.

Surprisingly even when switched to environment isort, or even when path set to the which isort that actually works properly from the command line.

isort --diff --resolve-all-configs components/core/app/gunicorn_app.py gives completely different output as does in VScode, using the mentioned --resolve-all-configs arg, no matter bundled, environment or path explicit is setted up.

I've an instance of setup.cfg file both in project's root folder and in components/core folder, main difference is the headings strings and a known_first_party=app setting on the one in components/core folder.

This works flawlessly on command line.

`isort` does not pick up settings if they are not in the workspace folder

I have two VSCode dev environments:

One is my local workstation VScode (mac) with the latest isort and black available in $PATH.
The other one is pure devcontainer with controlled environment and the latest isort and black available as well.

Before the latest vscode isort and black extensions. I was able to pick the correct configuration using isort.cfg in the root of each project.

That way both VScode environments where not fighting with each other and were not applying different "standards".

With the installation of "ms-python.isort" the situation has changed:
Local vscode is using new "built-in" isort.
While I by default was not able to install dev-extenstion in dev-container - container continued using standard isort.

this is the only isort config included in both vscode settings and isort.cfg

"isort.args":[
		"--profile",
		"black",
		"--skip-gitignore",
		"--line-length",
		"99"
],

Now ms-python.isort is trying to apply this standard:

import logging

from config import settings as s
from selenium import webdriver

while native isort is trying to apply:

import logging

from selenium import webdriver

from config import settings as s

MS extension is putting local module with the third-party module in one section and alphabetically above it.

Your ms-python.isort built-in isort is using "wrong", non-default sections setting. Thas is documented here:
https://pycqa.github.io/isort/docs/configuration/custom_sections_and_ordering.html

I need this:

sections=FUTURE,STDLIB,FIRSTPARTY,THIRDPARTY,LOCALFOLDER

Providing "isort.path": ["/usr/local/bin/isort"] setting has completely broken Formatting. Will open separate issue.

`isort` formatter server crashes on 3.11

Type: Bug

Start VS Code on my project.

I cannot reproduce on other projects. I have followed the instructions on a similar issue I found (reinstall all extensions) and that had no effect. The other issue mentioned a workspace file - I have no .vscode directory in this project folder, and I don't know where else I should look.

Restarting the isort server just produces the same error.

Extension version: 2022.2.0
VS Code version: Code 1.70.0 (da76f93349a72022ca4670c1b84860304616aaa2, 2022-08-04T04:38:16.462Z)
OS version: Windows_NT x64 10.0.22000
Modes:

System Info
Item Value
CPUs Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz (16 x 2400)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 31.73GB (16.11GB free)
Process Argv --crash-reporter-id d99325fe-b12a-45c2-b763-29c3a74b710e
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
pythonvspyl392:30443607
vserr242cf:30382550
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263cf:30335440
vscoreces:30445986
pythondataviewer:30285071
vscod805:30301674
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
cmake_vspar411:30542924
vsaa593:30376534
vsc1dst:30438360
pythonvs932:30410667
wslgetstarted:30449410
vscscmwlcmt:30465135
cppdebug:30492333
vscaat:30438848
pylanb8912:30529769
vsclangdf:30486550
c4g48928:30535728
d7fjc500:30543455
dsvsc012:30540252

Detect isort config files and restart server on change.

My project has a .isort.cfg file specifying profile=black. The extension doesn't take account of this file, so I need to add the profile to my extension settings as well (and keep the two in line).

The extension should respect any of the config locations that isort supports.

High RAM usage in WSL2

I am using VSCode and the isort extension v2022.2.0 (isort=5.10.1)

My pyproject.toml contains:

[tool.isort]
profile = "black"
line_length = 88
multi_line_output = 3
include_trailing_comma = true
skip_gitignore = true
skip = ["notebooks", "resources", "data"]
known_third_party = ["wandb", "hydra"]

I get really high RAM usage for the format_server.py. I tried increasing the WSL2 memory, but after a while the isort format server allocates all free memory on my ubuntu subsystem, until the swap is full and my wsl freezes.

image

The logs contain

Formatter Name: isort
Formatter Module: isort
CWD Format Server: /home/flo/dev/redacted
sys.path used to run Formatter:
    /home/flo/.vscode-server/extensions/ms-python.isort-2022.2.0/bundled/formatter
    /usr/lib/python39.zip
    /usr/lib/python3.9
    /usr/lib/python3.9/lib-dynload
    /home/flo/dev/redacted/.venv/lib/python3.9/site-packages
    /home/flo/dev/redacted
    /home/flo/.vscode-server/extensions/ms-python.isort-2022.2.0/bundled/libs

Settings used to run Formatter:
[
    {
        "workspace": "file:///home/flo/dev/redacted",
        "trace": "error",
        "args": [],
        "severity": {},
        "path": [],
        "interpreter": [
            "/home/flo/dev/redacted/.venv/bin/python"
        ]
    }
]

I get a few exceptions based on #isort: skip_file comments:

Traceback (most recent call last):
  File "/home/flo/.vscode-server/extensions/ms-python.isort-2022.2.0/bundled/formatter/format_server.py", line 143, in _run
    result = utils.run_module(
  File "/home/flo/.vscode-server/extensions/ms-python.isort-2022.2.0/bundled/formatter/utils.py", line 177, in run_module
    return _run_module(module, argv, use_stdin, source)
  File "/home/flo/.vscode-server/extensions/ms-python.isort-2022.2.0/bundled/formatter/utils.py", line 162, in _run_module
    runpy.run_module(module, run_name="__main__")
  File "/usr/lib/python3.9/runpy.py", line 213, in run_module
    return _run_code(code, {}, init_globals, run_name, mod_spec)
  File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/flo/dev/redacted/.venv/lib/python3.9/site-packages/isort/__main__.py", line 3, in <module>
    main()
  File "/home/flo/dev/redacted/.venv/lib/python3.9/site-packages/isort/main.py", line 1119, in main
    incorrectly_sorted = not api.check_stream(
  File "/home/flo/dev/redacted/.venv/lib/python3.9/site-packages/isort/api.py", line 264, in check_stream
    changed: bool = sort_stream(
  File "/home/flo/dev/redacted/.venv/lib/python3.9/site-packages/isort/api.py", line 218, in sort_stream
    raise FileSkipComment(content_source)
isort.exceptions.FileSkipComment: /home/flo/dev/redacted/__init__.py contains a file skip comment and was skipped.

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.