Skip to content
This repository was archived by the owner on Aug 2, 2022. It is now read-only.
This repository was archived by the owner on Aug 2, 2022. It is now read-only.

atom-python-isort runs on saved file, rather than editor content #34

Open

Description

The expected behavior of 'python-isort:sortImports' is that it runs on the current editor's contents, using isort to directly convert text.

eg:

new_contents = SortImports(file_contents=old_contents).output

Instead, the sortImports function runs isort on 'getFilePath', which means that isort doesn't appear to do anything if the file has not been saved immediately before running sortImports.

I think it's probably bad form to directly edit the focused .py file, rather than changing the editor's contents, because it doesn't allow for the user to view and/or revert the changes that isort makes.

I'd be happy to update this behavior, if nobody else wants to.

Activity

  1. lexicalunit commented on Jun 5, 2017

    @lexicalunit
    Contributor

    That would be a nice feature but the package works by calling the command line tool isort on the file. The isort tool itself is implemented in python so there's no simple and straight-forward way to call it from the js/coffee source of the atom-python-isort package as you've suggested. Also, please consider https://github.com/lexicalunit/atom-isort instead, as this package seems to have become defunct.

  2. lexicalunit commented on Jun 8, 2017

    @lexicalunit
    Contributor

    Nice! I'm definitely interested in this feature! If you make a PR against lexicalunit/atom-isort we can iterate on it through the review process until we come up with something we're both happy with. I'm gonna be out for a bit though as I'm getting sinus surgery tomorrow morning.

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions