-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Open
Labels
bugSomething isn't workingSomething isn't workingformatterRelated to the formatterRelated to the formatter
Description
Summary
I am not sure if this is a vscode plugin or ruff issue, that said:
When using the "editor.formatOnSaveMode": "modificationsIfAvailable"
setting, Ruff does not add blank lines around newly added classes. This results in the CI checking the entire file finding new issues in the file.
Example:
def oldCode():
...
class InsertedClass: # New
pass # New
def moreOldCode():
...
After formating I get the formated class back as (formatting inside the class I added works as expected):
class InsertedClass: # New
pass # New
I would like the language server to return the new class with surrounding needed whitespace if that is possible, i.e.:
# ruff add whitespace before
# ruff add whitespace before
class InsertedClass: # New
pass # New
# ruff add whitespace after
# ruff add whitespace after
I have not dug into the language server protocol and I am not sure if this is feasible (i.e. does the language server get enough context (i.e. code outside the edited area), when modificationsIfAvailable
is set?
Version
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingformatterRelated to the formatterRelated to the formatter