Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

quick-fix for un-sorted imports not working #180

Closed
HansAarneLiblik opened this issue May 23, 2023 · 5 comments · Fixed by #182
Closed

quick-fix for un-sorted imports not working #180

HansAarneLiblik opened this issue May 23, 2023 · 5 comments · Fixed by #182
Labels
enhancement New feature or request

Comments

@HansAarneLiblik
Copy link

Re-posted from ruff github:

I'm seeing an issue with ruff and quick-fixes it offers to Intellij

I have the following file

from typing import assert_type, assert_never


if __name__ == '__main__':
    assert_never("test")
    assert_type(123, int)

and ruff complains about imports

image

When I click organize imports, it breaks the code

ffrom typing import assert_never, assert_type

f __name__ == '__main__':
    assert_never("test")
    assert_type(123, int)

Executing the fix from command line works ruff . --fix

My config from pyproject.toml

[tool.isort]
profile = "black"
line_length = 120
filter_files = true


[tool.ruff]
line-length = 120
target-version = "py310"
select = [
  "E",    # pycodestyle
  "W",    # pycodestyle
  "F",    # pyflakes
  "I",    # isort
  "C4",   # flake8-comprehensions
  "TID",  # flake8-tidy-imports
]
  • IDE: PyCharm 2023.1.2
  • OS: Mac OS 13.2.1
  • Ruff version: 0.0.269
  • Plugin version: 0.0.4
@charliermarsh
Copy link

@koxudaxi - Sorry for the churn, we changed the edit columns to be one-based rather than zero-based, which is probably the cause of this discrepancy. Here's the relevant PR in the LSP: astral-sh/ruff-lsp#103.

@johnthagen
Copy link

Multiple team members noticed this at work as well. Glad it looks to be a simple fix!

@koxudaxi
Copy link
Owner

I'm Sorry for my slow action.
I have released the fxied version as 0.0.16
We should wait for approval from JetBrains. After that, it will be published in the JetBrains Market.
https://plugins.jetbrains.com/plugin/20574-ruff/versions/stable/339105

There are binaries on the page. We can install it manually before will be published in the JetBrains Market.
https://github.com/koxudaxi/ruff-pycharm-plugin/releases/tag/v0.0.16
https://www.jetbrains.com/help/idea/managing-plugins.html#install_plugin_from_disk

@koxudaxi koxudaxi pinned this issue May 26, 2023
@koxudaxi
Copy link
Owner

It's approved.
We can install the fixed version 0.0.16 from JetBrains Market.

@HansAarneLiblik
Copy link
Author

Works perfectly. Thank you !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants