Skip to content

Prompt user to save before running commands (e.g. formatting) #2980

Closed as not planned

Description

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.

Activity

  1. added
    feature-request
    needs proposal
    on Oct 22, 2018
  2. DonJayamanne commented on Oct 23, 2018

    @DonJayamanne

    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.

  3. brettcannon commented on Oct 23, 2018

    @brettcannon
    MemberAuthor

    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).

  4. lig commented on Nov 12, 2018

    @lig

    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!

  5. adamzev commented on May 17, 2019

    @adamzev

    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.

  6. brettcannon commented on May 27, 2019

    @brettcannon
    MemberAuthor

    @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.

  7. DonJayamanne commented on May 28, 2019

    @DonJayamanne

    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.

  8. PeterJCLaw commented on Jan 3, 2020

    @PeterJCLaw

    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.

  9. removed their assignment
    on May 12, 2022
  10. brettcannon commented on Dec 8, 2022

    @brettcannon
    MemberAuthor

    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.

  11. locked as resolved and limited conversation to collaborators on Jan 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-editor-*feature-requestneeds proposal

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions