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

Healer module #2742

Merged
merged 3 commits into from
Mar 3, 2025
Merged

Healer module #2742

merged 3 commits into from
Mar 3, 2025

Conversation

pbwolf
Copy link
Contributor

@pbwolf pbwolf commented Mar 2, 2025

Dear @PEZ , is this the kind of module or modularity you had in mind, with respect to extracting the whitespace edits from a reformatted result? For simplicity to clarify the goal, this PR extracts the clever healing and removal-of-plasters from format.ts into a module and adds tests for it.

What has changed?

  • A module is extracted from format.ts to clarify healing/unhealing as a testable unit. (Healing an unformatted code fragment prepends and appends brackets to make it syntactically plausible enough to be submitted to a program-code formatter. After the well-formed code block has been processed by a source-code formatter, unhealing rips off the fabricated brackets and fixes up indentation of lines after the first one, to make a drop-in formatted replacement for the original fragment.)
  • Tests are added for the healer module.

This is inspired by a comment by @PEZ on PR #2741

//Fixes #

My Calva PR Checklist

I have:

  • Read How to Contribute.
  • Directed this pull request at the dev branch. (Or have specific reasons to target some other branch.)
  • Made sure I have changed the PR base branch, so that it is not published. (Sorry for the nagging.)
  • Made sure there is an issue registered with a clear problem statement that this PR addresses, (created the issue if it was not present).
    • Updated the [Unreleased] entry in CHANGELOG.md, linking the issue(s) that the PR is addressing.
  • Figured if anything about the fix warrants tests on Mac/Linux/Windows/Remote/Whatever, and either tested it there if so, or mentioned it in the PR.
  • Added to or updated docs in this branch, if appropriate
  • Tests
    • Tested the particular change
    • Figured if the change might have some side effects and tested those as well.
  • Formatted all JavaScript and TypeScript code that was changed. (use the prettier extension or run npm run prettier-format)
  • Confirmed that there are no linter warnings or errors (use the eslint extension, run npm run eslint before creating your PR, or run npm run eslint-watch to eslint as you go).

Ping @PEZ, @bpringe, @corasaurus-hex, @Cyrik

Copy link

netlify bot commented Mar 2, 2025

Deploy Preview for calva-docs ready!

Name Link
🔨 Latest commit 7f1d192
🔍 Latest deploy log https://app.netlify.com/sites/calva-docs/deploys/67c592fd7889050008d7cb88
😎 Deploy Preview https://deploy-preview-2742--calva-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@PEZ
Copy link
Collaborator

PEZ commented Mar 3, 2025

Awesome. Yes, this is exactly the kind of extraction I meant.

Please update the changelog and we can merge this.

@PEZ PEZ merged commit 524b80f into BetterThanTomorrow:dev Mar 3, 2025
5 checks passed
@PEZ
Copy link
Collaborator

PEZ commented Mar 3, 2025

Thanks! 🙏

Generally we want an issue describing the problem statement that is closed by the PR. In this case maybe it was development internal (but we usually create issues for that as well). This time I solved it by linking the changelog entry to the PR. This way if someone later runs into issues and suspects this change, they can easily find the commits.

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.

2 participants