microsoft / vscode-isort

Import sorting for python using the isort library.
https://marketplace.visualstudio.com/items?itemName=ms-python.isort
MIT License
87 stars 21 forks source link

Add warning/notice or explicit error regarding args structure #148

Closed iron3oxide closed 2 years ago

iron3oxide commented 2 years ago

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

eleanorjboyd commented 2 years ago

Hello! Thank you for the suggestion, but since parsing for all the different types of shell is very difficult and error prone this concept is out of scope for our extension.