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

fix: Ensure #| is added only at the beginning of a new line #649

Merged
merged 4 commits into from
Mar 10, 2025

Conversation

mcanouil
Copy link
Contributor

@mcanouil mcanouil commented Feb 3, 2025

Adjust the insertion logic to guarantee that #| is added at the start of a new line, addressing issues with code formatting on return. Fixes #426

Proposed behaviour:

Screen.Recording.2025-02-03.at.14.13.16.mov

@mcanouil
Copy link
Contributor Author

mcanouil commented Mar 6, 2025

@cscheid @juliasilge gentle ping for this as it’s really a daily pain to have to fix the bad insertion.

Copy link
Collaborator

@juliasilge juliasilge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took a look at this, and we don't see the bad behavior from #426 in Positron because of onEnterRules for R and Python files, which get piped through and applied via the virtual documents that Quarto creates. So this change is not really applicable for Positron. I do think we'll eventually need to resolve the edit builder here with onEnterRules that other extensions can provide.

I do see the bad behavior in VS Code, and this PR fixes the problem. ✅

@mcanouil
Copy link
Contributor Author

mcanouil commented Mar 8, 2025

I do think we'll eventually need to resolve the edit builder here with onEnterRules that other extensions can provide.

I do agree 100% with that but this means quite a change in the VSCode extension codebase which I was not willing to undertake at this point, especially without any tests.
The PR is really here to simply fix the current implementation not to improve/refactor it.

@juliasilge juliasilge merged commit e268ba4 into quarto-dev:main Mar 10, 2025
1 check passed
@mcanouil mcanouil deleted the fix/issue426 branch March 10, 2025 15:02
kylebutts pushed a commit to kylebutts/quarto that referenced this pull request Mar 10, 2025
…-dev#649)

* fix: add offset to ensure `#|` is added at the beginning

Fixes quarto-dev#426

* chore: add changelog entry
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.

Auto addition of #| messes code on "return"
2 participants