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

Support format modificationsIfAvailable #319

Closed
rmallampalli opened this issue Oct 31, 2023 · 1 comment · Fixed by astral-sh/ruff-lsp#373
Closed

Support format modificationsIfAvailable #319

rmallampalli opened this issue Oct 31, 2023 · 1 comment · Fixed by astral-sh/ruff-lsp#373
Labels
enhancement New feature or request

Comments

@rmallampalli
Copy link

VS Code currently has a setting editor.formatOnSaveMode which allows to format only the modified lines according to source control. Currently if it is set to modifications or modificationsIfAvailable, ruff fails silently. Only setting it to file works: please consider throwing an error if the setting is changed. I would also like the modificationsIfAvailable option to be supported.

My use case is as follows: in certain codebases full files cannot be formatted as that would make reading the diffs between working state and old commits quite difficult.

This may be related to this open issue in the ruff repo.

I use the binary shipped with v2023.44.0 of the extension.
My settings file:

    "[python]": {
        "editor.defaultFormatter": "charliermarsh.ruff",
    },
    "notebook.formatOnSave.enabled": true,
    "editor.formatOnSaveMode": "modifications",
    "inlineChat.showDiff": false,
    "editor.formatOnPaste": true,
    "editor.formatOnType": true,
    "editor.formatOnSave": true
@charliermarsh charliermarsh added the enhancement New feature or request label Oct 31, 2023
@MichaReiser
Copy link
Member

MichaReiser commented Jan 22, 2024

Here a link to the announcement of the new setting. It requires support for the Range formatting LSP operation

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.

3 participants