You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Prompt user to save before running commands (e.g. formatting) #2980
A few times people have asked about running commands like import sorting, formatting, etc. on modified (not saved) or brand new files (i.e. Untitled-1). We should notify users that the command does not work on such files so they don't get a weird error message talking about e.g. EACCES.
Don Jayamanne (@DonJayamanne) in case of #3306 there is no indication in the output at all. At least, some notification there would save a lot of time and should make things less ambiguous. Thanks!
I'd much rather that isort just works on unsaved files than a prompt to save if that's possible (at least for files that aren't brand new). My workflow is often, add a new import to a file in a random spot, run sort imports and then save. I guess my workflow for the tool to work correctly needs to be, add an import, save, sort, save which adds an extra save step. I'm still experiencing .isort.cfg being ignored so I'm assuming that #4433 was closed without a fix pending this issue.
@tutordelphia is there a command-line flag to isort which lets you specify the path to a config file? I looked at isort's code and didn't find such a CLI flag we could use in this unsaved file situation.
I looked at isort's code and didn't find such a CLI flag we could use in this unsaved file situation.
We implemented an approach of creating temp files in the working directory, so that isort and other formatter will pick config files from working directory without us having to manually look for them.
I looked at isort's code and didn't find such a CLI flag we could use in this unsaved file situation.
We implemented an approach of creating temp files in the working directory, so that isort and other formatter will pick config files from working directory without us having to manually look for them.
isort can be passed '-' as the file to sort, which causes it to look at STDIN. #9128 changes vscode-python to use that option, which may help with this issue, though that PR makes the change for other reasons.
Thanks to LSP and moving tool support to separate extensions, this isn't so much a concern (and very much a per-tool extension question). Closing as out of date.
Activity
DonJayamanne commentedon Oct 23, 2018
I believe we should instead do with other extensions and languages in VS Code do.
I.e. we need to be consistent across VS Code.
brettcannon commentedon Oct 23, 2018
And when Don says "do what others do", that means researching what other extensions do (or ask VS Code on their thoughts on the topic).
lig commentedon Nov 12, 2018
Don Jayamanne (@DonJayamanne) in case of #3306 there is no indication in the output at all. At least, some notification there would save a lot of time and should make things less ambiguous. Thanks!
adamzev commentedon May 17, 2019
I'd much rather that isort just works on unsaved files than a prompt to save if that's possible (at least for files that aren't brand new). My workflow is often, add a new import to a file in a random spot, run
sort importsand then save. I guess my workflow for the tool to work correctly needs to be, add an import, save, sort, save which adds an extra save step. I'm still experiencing.isort.cfgbeing ignored so I'm assuming that #4433 was closed without a fix pending this issue.brettcannon commentedon May 27, 2019
@tutordelphia is there a command-line flag to isort which lets you specify the path to a config file? I looked at isort's code and didn't find such a CLI flag we could use in this unsaved file situation.
DonJayamanne commentedon May 28, 2019
We implemented an approach of creating temp files in the working directory, so that isort and other formatter will pick config files from working directory without us having to manually look for them.
PeterJCLaw commentedon Jan 3, 2020
isortcan be passed'-'as the file to sort, which causes it to look atSTDIN. #9128 changes vscode-python to use that option, which may help with this issue, though that PR makes the change for other reasons.brettcannon commentedon Dec 8, 2022
Thanks to LSP and moving tool support to separate extensions, this isn't so much a concern (and very much a per-tool extension question). Closing as out of date.