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

RFC: Bundle of widget improvements #2963

Closed
Vtec234 opened this issue Nov 26, 2023 · 2 comments
Closed

RFC: Bundle of widget improvements #2963

Vtec234 opened this issue Nov 26, 2023 · 2 comments
Labels
RFC Request for comments

Comments

@Vtec234
Copy link
Member

Vtec234 commented Nov 26, 2023

Proposal

  • This RFC proposes a bundle of improvements to user widgets that I identified over the year from bug reports to ProofWidgets4, as well as my own usage.

  • Generalize basic widget declarations.

    • Motivation. When designing user-widgets, our original understanding of "widget" was roughly as "something that could be displayed in the infoview next to the tactic state". With ProofWidgets it became clear that this isn't general enough; for instance, it is useful to be able to declare widgets that are merely subcomponents (for instance, a single button) to be used in other components but which shouldn't be displayed at the top-level.
    • Thus we generalize "user widget" which has a mandatory user-visible name (under the assumption that it will be shown at the top-level) to "widget module" which is just an arbitrary JS module. We now call JS module that produce a React component suitable for top-level display "panel widgets".
    • Implementation.
      • Deprecate Widget.UserWidgetDefinition in favour of Widget.Module which does not require a name field.
        • In pictures, before the change the widget writer controls the blue box and the string contents of the title. After the change, they control the orange box. Screenshot 2023-11-26 at 1 03 18 AM
      • Deprecate the @[widget] attribute in favour of a @[widget_module] attribute.
      • Rename ofUserWidget to ofPanelWidget to clarify when panel widgets are being used, and other definitions accordingly. (This change was abandoned.)
  • Allow storing RPC references in widget props.

  • Add ability to display a widget everywhere (global), and everywhere within a given file (local).

  • Show all widget infos on the cursor's line rather than just those whose span contains the cursor position.

  • Beneficiaries: Users of widgets, e.g. in mathlib4.

  • Maintainability: There is now an extra environment extension, though I was also able to remove one. Overall complexity did not increase significantly.

Community Feedback

Community feedback was gathered largely in-person or in DMs.

Impact

Add 👍 to issues you consider important. If others benefit from the changes in this proposal being added, please ask them to add 👍 to it.

@Vtec234 Vtec234 added the RFC Request for comments label Nov 26, 2023
@Vtec234
Copy link
Member Author

Vtec234 commented Nov 26, 2023

@Kha I would appreciate your feedback. I am hoping this does not conflict significantly with your new infrastructure.

@Kha
Copy link
Member

Kha commented Nov 30, 2023

No reservations from my side :) . It all sounds sensible to me.

github-merge-queue bot pushed a commit that referenced this issue Dec 21, 2023
Implements RFC #2963.

Leftover tasks:
- [x] Provide companion PR to vscode-lean4 (leanprover/vscode-lean4#376)
- [x] Companion PR to std4 (leanprover-community/batteries#467)
- [x] Companion PR to ProofWidgets4
(leanprover-community/ProofWidgets4#36)
- [X] Companion commit to mathlib4
(leanprover-community/mathlib4@0f4660f)
- [ ] ~~Update the manual chapter~~ (will do in a follow-up)
@Vtec234 Vtec234 closed this as completed Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFC Request for comments
Projects
None yet
Development

No branches or pull requests

2 participants