Skip to content

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

Open

Description

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    bugIssue identified by VS Code Team member as probable bugneeds investigation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions