leanprover / leanprover/lean4

RFC: Interactions between different widgets

Open
#7,821 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

P-medium RFC
Dominant language
Lean
Stars
9.2k
Forks
990
Avg merge
1d 17h
Merged PRs (30d)
175

Description

Proposal

It would be nice to give widgets access to some shared state. This would allow some form of communication between widgets.

In Verbose Lean, there is a general suggestion widget that allows to select expressions in the tactic state and get suggestions for a next step. When enabled in an exercise, this widget is always shown in the proof. But there is also a more specialized widget for calc block that is shown when the cursor is inside a calc. The specialized widget needs to switch off the general one, otherwise the UI becomes very confusing.

This is currently done by CSS injection: the specialized widget includes a html style tag that changes the display html property of the general widget. But this is a horrible hack and won’t work in neovim.

One fix would be to allow Lean libraries to define global tactic state variables that widgets could read and write. Verbose Lean would define a global “display general suggestion widget” flag, with initial value true. The general suggestion widget would read that flag before deciding to emit anything (or alternatively the exercise elaborator would read it) and the specialized calc widget would set it to false.

Community Feedback

Wojciech told me there is currently no way to do that. Marc asked to create a brief RFC here.

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the general suggestion widget and the specialized calc widget described in the proposal, including their current CSS-injection interaction. Determine the project-supported mechanism for shared widget state and define how the general widget can be suppressed in both the browser UI and Neovim; the RFC is complete when that design is agreed and actionable.

Written by the indexing model from the issue text.

Assessment

Domain
compilers, devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.