generated from microsoft/vscode-python-tools-extension-template
-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
When formatting using ruff-api, the extension's formatter adds newlines after comments. This appears to only happen on Windows.
This snippet of example code when formatted via the extension will continually add newlines after every line of the block comment and new lines after the single line comment.
points = [[10, 10], [10, 11], [11, 10], [11, 11]]
manual_dummy_config = f"""
[common]
lb = [10, 10]
ub = [11, 11]
parnames = [par1, par2]
outcome_types = [binary]
stimuli_per_trial = 1
strategy_names = [init_strat]
[init_strat]
generator = ManualGenerator
[ManualGenerator]
points = {points}
seed = 123
"""
# reading config
print(manual_dummy_config)
gets formatted into:
points = [[10, 10], [10, 11], [11, 10], [11, 11]]
manual_dummy_config = f"""
[common]
lb = [10, 10]
ub = [11, 11]
parnames = [par1, par2]
outcome_types = [binary]
stimuli_per_trial = 1
strategy_names = [init_strat]
[init_strat]
generator = ManualGenerator
[ManualGenerator]
points = {points}
seed = 123
"""
# reading config
print(manual_dummy_config)
Even worse, if formatted again, it'll add even more newlines.
The VSCode ufmt output is as follows:
formatting in-process
CWD Linter: ...\ae\aepsych
formatting with: ufmt==2.8.0 black==24.4.2 libcst==1.5.1 ruff-api==0.1.0 usort==1.0.8.post1
formatting complete
When using ufmt CLI separately, this does not happen. The CLI reports nothing needs to be formatted in a file containing the above snippet.
Metadata
Metadata
Assignees
Labels
No labels