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: make LSP config available synchronously #2676

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

Conversation

pbwolf
Copy link

@pbwolf pbwolf commented Dec 22, 2024

This pull request is for review and comment. It is preparation for fixing #2611.

What has changed?

lsp.api.getCljFmtConfig(client) is cached (forever) (cached once, covering all documents), in order for synchronous Paredit commands to use the format config - or in other words, to enable Paredit commands to be made synchronous and more reliable even if they want to refer to formatter config, which heretofore is async.

  • formatter-config.getConfig is no longer async. It includes LSP's settings if they're already cached, otherwise it starts an async retrieval that will eventually cache the LSP settings.
  • Consequently:
    • format.ts indentPosition, formatPositionInfo, and formatCode are no longer async.
    • paredit/extension.ts's pareditCommands entry for paredit.deleteBackward can get started without waiting for LSP's config. This might be a partial fix for Paredit garbles while backspacing rapidly #2611 already but the effect, if noticeable at all, is pretty modest.

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.
  • 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 features relying on formatter-config are already tested Tests
    • N/A Tested the particular change
    • Don't Know 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 b55edc3
🔍 Latest deploy log https://app.netlify.com/sites/calva-docs/deploys/6768808bb5b283000857ad31
😎 Deploy Preview https://deploy-preview-2676--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.

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