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

[Merged by Bors] - feat(widget): component.with_effects #370

Closed
wants to merge 3 commits into from

Conversation

EdAyers
Copy link
Member

@EdAyers EdAyers commented Jun 30, 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

lean_assert(g_context);
return g_context;
}
void set_global_widget_context(widget_context * wc) {
Copy link
Member

Choose a reason for hiding this comment

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

Please turn this into a scope_global_widget class.

Ideally, I'd like to avoid additional global variables. Is it instead possible to turn this into an extra argument to handle_event?

Instead it's passed as an argument.
I think there is some possible refactoring so that everything lives
inside widget_context. I am imagining something similar to pp_fn used in
pp.cpp. But for now this will do.
@gebner
Copy link
Member

gebner commented Jul 2, 2020

bors merge

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
@bors
Copy link

bors bot commented Jul 2, 2020

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title feat(widget): component.with_effects [Merged by Bors] - feat(widget): component.with_effects Jul 2, 2020
@bors bors bot closed this Jul 2, 2020
@bors bors bot deleted the widget-effects branch July 2, 2020 12:48
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