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

2611 paredit delete backward races sync registration #2675

Conversation

pbwolf
Copy link

@pbwolf pbwolf commented Dec 22, 2024

This pull request is mainly for review and comment. It is preparation for a fix to #2611. I don't know whether the change in this PR by itself would be noticeable.

This change adjusts paredit to allow non-async commands to be more responsive and reliable. Heretofore all Paredit commands are async, but this change registers commands as synchronous if their async was only nominal. The goal is to reduce race conditions among multiple commands concurrently in progress (e.g., when keyboard auto-repeat outruns execution), by opting-out of concurrent execution where possible. (Races between document-change notification events and command handlers are still possible, though.)

What has changed?

  • pareditCommands (data structure) distinguishes synchronous handler from asyncHandler. For the time being, the handlers themselves are not rewritten in this patch to be less-asynchronous than they already were. Therefore, motion and selection commands are synchronous and document modification commands remain async.
  • activate uses registerTextEditorCommand for synchronous handlers, registerCommand for async.
  • wrapPareditCommand passes to synchronous command handlers the TextEditorEdit provided by VS Code (removing the need for the handlers to use TextEditor.edit, which is async).

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).
    • Updated the [Unreleased] entry in CHANGELOG.md, linking the issue(s) that the PR is addressing.
  • N/A 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.
  • N/A Added to or updated docs in this branch, if appropriate
  • I suppose Paredit features already have tests 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 Dec 22, 2024

Deploy Preview for calva-docs ready!

Name Link
🔨 Latest commit 7a81698
🔍 Latest deploy log https://app.netlify.com/sites/calva-docs/deploys/67687c25c1e724000850c704
😎 Deploy Preview https://deploy-preview-2675--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.

@pbwolf pbwolf closed this Dec 29, 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.

1 participant