rimvaliulin / isorted

isort integration for Sublime Text
GNU General Public License v3.0
11 stars 2 forks source link

Support configs in sublime project settings and more isort options #4

Closed returnchung closed 1 year ago

returnchung commented 1 year ago

Considering different isort configs are used in different projects, if we can also configure in the specific sublime project settings instead in the .isort.cfg or pyproject.toml, it's helpful, especially when you contribute to different projects but without isort config files.

Besides, the isort has many options to sort, so we should also support to configure options in the package and project settings for common use and let it extendable for more flexible usage in the future. To do so, we can define some settings - options commands mapping and append to the isort_command to run in subprocess once user specified. For instance:

{
    "multi_line": "--multi-line",
    "line_length": "--line-length",
    "profile": "--profile",
    "float_to_top": "--float-to-top",
    "future": "--future",
    "thirdparty": "--thirdparty",
    "project": "--project",
    "known_local_folder": "--known-local-folder"
}
rimvaliulin commented 1 year ago

Just added some fixes, welcome to test.

returnchung commented 1 year ago

Thanks for supporting package and project settings and isort options, that's really amazing. I've tested and found some bugs, and create a Pull Request for you. Please take a look and let me know if any concerns.

rimvaliulin commented 1 year ago

I already done some fixes, so closed your pr.

returnchung commented 1 year ago

There's still an issue on extending commands from list. The itertools.product is a generator of (option, value) tuple, so you need also to flat them. https://github.com/rimvaliulin/isorted/blob/e90dcffddb3348365a557079e2c806b67eca61c3/isorted.py#L140

inmate37 commented 1 year ago

@returnchung @rimvaliulin It would be much better to manually add custom.isort.cfg file for each project and add it to .gitignoreinstead of commiting unnecessary changes. Thanks to this new changes isorted stopped working with standard .isort.cfg config

returnchung commented 1 year ago

@inmate37 Yeah, it's doable to add .gitignore, however, there's still a situation that repository owner and contributors don't want include the irrelevant files in .gitignore either. Keep the plugin flexible and configurable is still a good thing and users can choose the prefer way in using plugin. And about new changes broken the isorted, I think @rimvaliulin has fixed in 1.0.6, please upgrade and try it again.

The most features in this Issue are covered in current version, so I'll close this. Thanks to @rimvaliulin again:)