Hydrogen: Idea/Question: Highlight current code cell

Created on 29 May 2017  路  8Comments  路  Source: nteract/hydrogen

One of the few things I miss after the migration Matlab->RStudio->Spyder->Atom/Hydrogen is the possibility to easily see in what cell the cursor currently is (and thus what will happen on run-cell):

image

This would probably be quite easy to implement in style.less if I am not mistaken.
Does anyone know of a simple way to access the region between the previous and current breakpoint?


This has been added to the Hydrogen Wiki Plugins and the Hydrogen Wiki Features. If you close this issue please remove it from the Hydrogen Wiki.

enhancement help wanted plugin-idea

Most helpful comment

@Foucl I have a working plugin concept for this under development (contributions welcome!).

@t9md you might be interested in this plugin as well, as it is more or less the implementation you describe above.

I hope to make the styling better among other things, but you can see the basic idea:

hydrogen show cell

All 8 comments

This would probably be quite easy to implement in style.less if I am not mistaken.
Does anyone know of a simple way to access the region between the previous and current breakpoint?

When a run-cell command is called we use a regular expression based function to determine what code should run depending on the user's current cursor position. Since this only occurs as needed there wont be a selector you could use to access via styles.less as of now.

@t9md Based on some of your recent work I wonder if you have any thoughts on how this could be implemented?

The idea I can come up with is

  • We write output in createResultBubble(and _createResultBubble) , in spite of name it also render global output(?)
  • So make _createResultBubble accept cell(= Range) instead of current code. since we can not determine whether we should highlight or not until final code evaluation phase.

Then just highlight range(=mark range && decorate that marker) with class hydrogen-cell,use style by CSS.
This cell decoration must be deleted as same timing of destroying bubble maybe.

thank you! I suppose it's not as easy. I suppose it's harder than I thought and the suggested solution would rely on the cell actually being run.

If no one else is interested, I should probably close this issue and avoid cluttering the repo? Maybe it's an idea for a plugin. Before I try that, I'd like to give another, only somewhat related thought I had a shot (a plugin that allows execution of the current python function if the cursor is inside one).

@Foucl I think we should keep this open since implementing as a plugin or in the core package will take some work and discussion. I try to close issues if there is nothing left to do on them (not the case here).

@Foucl I have a working plugin concept for this under development (contributions welcome!).

@t9md you might be interested in this plugin as well, as it is more or less the implementation you describe above.

I hope to make the styling better among other things, but you can see the basic idea:

hydrogen show cell

@BenRussert the link to your plugin is unfortunately dead. What is new address?

I would love such a plugin!

I've created a plugin that separates the cells with a horizontal line. It's not currently highlighting though but is useful to identify different cells.

https://atom.io/packages/hydrogen-cell-separator

Cheers,

JV

@jhabriel I wish you would have told us in some other form because this may have become buried. Anyways, I'll add your plugin to our list 鉂わ笍 馃憤

Was this page helpful?
0 / 5 - 0 ratings