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

Run ruff format when lsp formatting is invoked #56

Closed
wants to merge 1 commit into from

Conversation

mmcshane
Copy link
Contributor

@mmcshane mmcshane commented Nov 7, 2023

Adds the Subcommand enum to indicate which ruff subcommand should be executed by run_ruff. At this time, only check and format are supported. As different subcommands support different parameters, argument generation is delegated based on the specific subcommand value.

The ruff format subcommand does not currently organize imports and there does not appear to be a way to convince it to do so. Until a unified command exists the approach taken here is to format and then make a second run of ruff check that only performs import formatting.

Pursuant to #53

Adds the Subcommand enum to indicate which `ruff` subcommand should be
executed by `run_ruff`. At this time, only `check` and `format` are
supported. As different subcommands support different parameters,
argument generation is delegated based on the specific subcommand value.

The `ruff format` subcommand does not currently organize imports and
there does not appear to be a way to convince it to do so. Until a
unified command exists the approach taken here is to format and then
make a second run of `ruff check` that _only_ performs import
formatting.
@mmcshane
Copy link
Contributor Author

mmcshane commented Nov 7, 2023

Whoops. I'll come back with something that works 3.7+

@mmcshane mmcshane closed this Nov 7, 2023
@ccordoba12
Copy link
Member

We dropped support for Python 3.7 in python-lsp-server in version 1.8.0, so I think there's no need for it still being supported here.

@mmcshane
Copy link
Contributor Author

mmcshane commented Nov 7, 2023

Oh well I was using match so I needed changes for 3.8 regardless. FYI the CI is still testing 3.7.

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

Successfully merging this pull request may close these issues.

2 participants