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

add toggle-result-bubble command #875

Merged
merged 5 commits into from
Jun 21, 2017
Merged

Conversation

t9md
Copy link
Contributor

@t9md t9md commented Jun 15, 2017

Code is very rough state, but want to know how team feels about this.

toggle-bubble

What this PR do?

Add new command hydrogen:toggle-bubble

This command allow manually add/remove bubble(outlet of code evaluation).

  • If selection was empty, toggle bubble at current cursor line.
  • If executed with selection, toggle bubble at each line of selected lines.
  • What toggle means is
    • Add bubble at line if line have no bubble.
    • Remove bubble from line if line have bubble.

Motivation

Currently there is no way to add bubble without evaluating code.
So If I tried to place bubble where I want, I have to execute code, then frequently see duplicate declaration of variable like error in bubble.

e.g. let, const in JavaScript cannot be executed in same scope.

This can be avoided if user super carefully execute code, but I don't want to.

Instead, I want to

  • Place bubble before evaluating code.
  • Then execute from clean state(restart-kernel-and-re-evaluate-bubbles) and update bubbles.

This workflow have no mess, no duplicate declaration error, I prefer this workflow at least in small code snippet.

TODO

  • Use better icon for empty bubble(Just added and not yet evaluated state). I picked zap icon

@lgeiger
Copy link
Member

lgeiger commented Jun 19, 2017

Very cool, thanks for your work! That's super valuable for the workflow introduced in #861 🎉

Use better icon for empty bubble(Just added and not yet evaluated state).

I think the easiest thing would be to add a different icon here that indicates that this is just a placeholder.

@t9md
Copy link
Contributor Author

t9md commented Jun 20, 2017

Thanks @lgeiger for pointer.

Here are icon candidates for empty-bubble I could find from octicons.
How do you think?

  • eye
  • pin
  • zap( I like this )

tryit_js_ _tryit_ ___tryit

@t9md
Copy link
Contributor Author

t9md commented Jun 20, 2017

Ready to review.

For test spec.
I tried to add spec, but give up.
There is no existing test to actually activating Hydrogen package.
I need to understand how store is populated on after activation, and how it is used in the first place to write correct test, but this is too much for me for now sorry.

Copy link
Member

@lgeiger lgeiger left a comment

Choose a reason for hiding this comment

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

Awesome! I only have a minor comment.

Yeah, the zap icon looks super cool, though I wonder if pin would be more meaningful. @BenRussert @rgbkrk What do you think?

For test spec.
I tried to add spec, but give up.
There is no existing test to actually activating Hydrogen package.
I need to understand how store is populated on after activation, and how it is used in the first place to write correct test, but this is too much for me for now sorry.

Thanks for looking into adding specs! I have a few improvements cued up, so we'll be able to move more logic out of main.js this should greatly help with testing.

for (let row = startRow; row <= endRow; row++) {
let destroyed = false;

_.forEach(this.markerBubbleMap, (bubble: ResultView) => {
Copy link
Member

Choose a reason for hiding this comment

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

What about just using clearBubblesOnRow here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wanted to know the result status(destroyed of not), but it not return result status.

I could write isRowContainsBubbke(row) predicate function to determine add or remove bubble, I just take simple imperative one.

Copy link
Member

Choose a reason for hiding this comment

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

Oh overlooked it, nevermind. I shouldn't review code on my phone 😄

@lgeiger lgeiger merged commit 9b1a5c3 into nteract:master Jun 21, 2017
@t9md
Copy link
Contributor Author

t9md commented Jun 21, 2017

Thanks for quick review and merging!!

@BenRussert
Copy link
Member

Thanks for looking into adding specs! I have a few improvements cued up, so we'll be able to move more logic out of main.js this should greatly help with testing.

@lgeiger +1 for moving logic out of main (and of course better testing) which is still open on #657 roadmap!

I think it will help new contributors to look at a clean main to understand program flow first at a high level. Then as a guide to find the functionality they are interested in!

@rgbkrk
Copy link
Member

rgbkrk commented Jun 21, 2017

Cool!

@mattiasarro
Copy link

This feature seems to have disappeared with some hydrogen update, or is it just me?

@wadethestealth
Copy link
Member

wadethestealth commented Jul 5, 2019

No it's not you it's gone see #1642 @mattiasarro

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.

6 participants