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

feat: widget messages #4254

Merged
merged 3 commits into from
May 29, 2024
Merged

feat: widget messages #4254

merged 3 commits into from
May 29, 2024

Conversation

Vtec234
Copy link
Member

@Vtec234 Vtec234 commented May 23, 2024

Allows embedding user widgets in structured messages. Companion PR is leanprover/vscode-lean4#449.

Some technical choices:

  • The MessageData.ofWidget constructor might not be strictly necessary as we already have MessageData.ofFormatWithInfos, and there is Info.ofUserWidget. However, .ofUserWidget also requires a Syntax object (as it is normally produced when widgets are saved at a piece of syntax during elaboration) which we do not have in this case. More generally, it continues to be a bit cursed that Elab.Info nodes are used both for elaboration and delaboration (pretty-printing), so entrenching that approach seems wrong. The better approach would be to have a separate notion of pretty-printer annotation; but such a refactor would not be clearly beneficial right now.
  • To support non-JS-based environments such as https://github.com/Julian/lean.nvim, .ofWidget requires also providing another message which approximates the widget in a textual form. However, in practice these environments might still want to support a few specific user widgets such as "Try this".

Closes #2064.

@Vtec234 Vtec234 marked this pull request as ready for review May 23, 2024 01:29
@Vtec234 Vtec234 requested review from nomeata and mhuisi May 23, 2024 01:29
@Vtec234 Vtec234 changed the title Widget messages feat: widget messages May 23, 2024
@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc May 23, 2024 01:47 Inactive
@github-actions github-actions bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label May 23, 2024
@leanprover-community-mathlib4-bot
Copy link
Collaborator

leanprover-community-mathlib4-bot commented May 23, 2024

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 2bc41d8f3aced0afb6e8d98dbd81d7d7a325da50 --onto ff37e5d512efcd3981290270a2fc3ecb100bbd0c. (2024-05-23 01:47:54)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase cc33c39cb022d8a3166b1e89677c78835ead1fc7 --onto 66777670e882edde86379fef6914b2938e93b51f. (2024-05-29 06:35:00)

@Vtec234 Vtec234 enabled auto-merge May 29, 2024 05:48
@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc May 29, 2024 06:37 Inactive
@Vtec234 Vtec234 added this pull request to the merge queue May 29, 2024
Merged via the queue into master with commit ec59e7a May 29, 2024
12 checks passed
@Vtec234 Vtec234 deleted the vtec234-widget-messages branch May 29, 2024 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RFC: Widget messages
3 participants