-
Notifications
You must be signed in to change notification settings - Fork 80
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
Conversation
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.
| reveal_position (file_name : string) (p : pos) | ||
| highlight_position (file_name : string) (p : pos) | ||
| clear_highlighting | ||
| custom (key : string) (value : string) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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
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.