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): widgets emit widget.effects #361

Closed
wants to merge 10 commits into from
Closed

Conversation

EdAyers
Copy link
Member

@EdAyers EdAyers commented Jun 26, 2020

save_widget now has the type pos -> component tactic_state widget.effects -> tactic unit.
This means that now the widget-writer can cause widget.effects
to issue a stream of commands to vscode to run side effects. Things like
highlighting a particular region of code or revealing a location in the
editor.

The next task is to add 'go to definition' for the default tactic
widget.

It should be backwards compatible with older versions, both for vscode and lean.

save_widget now has the type `pos -> component tactic_state
widget.effects`.
This means that now the widget-writer can cause widget.effects
to issue a stream of commands to vscode to run side effects. Things like
highlighting a particular region of code or revealing a location in the
editor.

The next task is to add 'go to definition' for the default tactic
widget.
@EdAyers EdAyers changed the title Widget actions feat(widget): widgets emit widget.effects Jun 26, 2020
| reveal_position (file_name : string) (p : pos)
| highlight_position (file_name : string) (p : pos)
| clear_highlighting
| custom (key : string) (value : string)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think the custom effect will be used for? You need to modify the vscode extension anyhow for a new effect type.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it just means that you can test out new effects without having to have a custom build of lean was the idea.

It still fails due to to_pos_info() not working?
Defaults to the current file, handled by vscode.
The problem was that `list<vm_obj> to_list(vm_obj const & x)` was not
doing what I thought it was doing.
@EdAyers EdAyers closed this Jun 27, 2020
@EdAyers EdAyers deleted the widget-actions branch June 30, 2020 13:01
bors bot pushed a commit that referenced this pull request Jul 2, 2020
supercedes #361 

with this PR, the user can attach a `with_effects` hook to a component and cause side-effects in vscode when an action is performed, currently supported are;
- highlighting parts of the doc,
- revealing a location (eg go to definition)
- inserting text above the cursor position.
- also a 'custom' effect for prototyping new effects

It should be fairly straightforward to add new effects if they are needed.

see also leanprover/vscode-lean#193
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.

None yet

2 participants