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

Highlighter stashes discovery of mismatched brackets in mirrorDoc[hig… #2674

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

pbwolf
Copy link

@pbwolf pbwolf commented Dec 21, 2024

What has changed?

highlight's extension.ts stashes a flag of misplaced brackets in mirrorDoc["highlightFoundMisplacedBrackets"].

This change supports a property-based integration test of potential race conditions in Paredit's deleteBackward for #2611. The property is "does the user see danger-flagged brackets?"

A couple of alternative approaches (for the test of #2611) were considered.

  • Specific expected document content. However, when Paredit finds it has inconsistent inputs (which may be unavoidable in VS Code's asynchronous world), the only way for Paredit not to mess up the document might be work-shedding, i.e., ignoring a keypress. This doubles the number of possible expected outcomes with each keypress. And it may take dozens or hundreds of keypresses to spark the race conditions.
  • For property-based testing, an alternative potential property might be token-cursor's docIsBalanced. However, at least under the stressful circumstances of the test, docIsBalanced sometimes does not notice unmatched parentheses highlighted by the highlighter.

Addressing #2611

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).
    • Unworthy of mention 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.
  • Did not notice applicable docs Added to or updated docs in this branch, if appropriate
  • Tests - forthcoming for Paredit garbles while backspacing rapidly #2611
    • 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 Dec 21, 2024

Deploy Preview for calva-docs ready!

Name Link
🔨 Latest commit 4dda5e6
🔍 Latest deploy log https://app.netlify.com/sites/calva-docs/deploys/67671e19a690ae0008f4de44
😎 Deploy Preview https://deploy-preview-2674--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 PEZ requested a review from bpringe December 22, 2024 16:22
@PEZ
Copy link
Collaborator

PEZ commented Dec 22, 2024

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