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

Formatting with extension adds extra lines after comments #125

Open
JasonKChow opened this issue Jan 7, 2025 · 0 comments
Open

Formatting with extension adds extra lines after comments #125

JasonKChow opened this issue Jan 7, 2025 · 0 comments

Comments

@JasonKChow
Copy link

JasonKChow commented Jan 7, 2025

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.

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

No branches or pull requests

1 participant