Git Product home page Git Product logo

Comments (15)

dgleich avatar dgleich commented on August 12, 2024 1

I would dearly love to have this feature. So much so that I'd been looking at what might be necessary to implement it.

In Hydrogen, the code to select the current cell is (https://github.com/nteract/hydrogen/blob/d850f50df78e20ff7d5918884155bb67bfa02cde/lib/code-manager.coffee):

    getCurrentCell: ->
        buffer = @editor.getBuffer()
        start = buffer.getFirstPosition()
        end = buffer.getEndPosition()
        regexString = @getRegexString @editor

        unless regexString?
            return [start, end]

        regex = new RegExp regexString
        cursor = @editor.getCursorBufferPosition()

        while cursor.row < end.row and @isComment cursor
            cursor.row += 1
            cursor.column = 0

        if cursor.row > 0
            buffer.backwardsScanInRange regex, [start, cursor], ({range}) ->
                start = range.start

        buffer.scanInRange regex, [cursor, end], ({range}) ->
            end = range.start

        console.log 'CellManager: Cell [start, end]:', [start, end],
            'cursor:', cursor

        return [start, end]

The Regex just checks if this is a "cell delimiter line" so I'm sure it would be easy to substitute in a regex for "##" until something else emerges.

Then in terms of atom-juno-client, it seems like you'd just need to either update the blocks.coffee code (https://github.com/JunoLab/atom-julia-client/blob/master/lib/misc/blocks.coffee) to add something about the cell...

Or maybe write a cells.coffee set of code with a 'get' function.

Finally, then you'd need to add something to evaluation.coffee (https://github.com/JunoLab/atom-julia-client/blob/master/lib/runtime/evaluation.coffee) to use the cell instead of the block.

I have zero free time, and have never done anything with coffee, etc. but I might be able to defer more important work to do this :)

from atom-julia-client.

JobJob avatar JobJob commented on August 12, 2024 1

I picked up from @dgleich's comment above, and got an initial version of this working. I don't really have time to make this better, and don't think it's quite ready for merging, but the commit is here if someone wants to run with it: JobJob@f2bff9b

It just adds one command: julia-client:run-cell. You separate cells with #---(delimiter is set here) and it will run the code in the cell the cursor is currently in.

Edit: found a little time to also add run-cell-and-move and decided to make a PR, latest version of code in PR linked below.

from atom-julia-client.

pfitzseb avatar pfitzseb commented on August 12, 2024 1

Sure, makes sense.

from atom-julia-client.

pfitzseb avatar pfitzseb commented on August 12, 2024

👍
Not sure what syntax would be better, but I kinda like ## since it's close to matlab and could be interpreted as markdown as well -- you jsut take a h2 and structure your code with that.

from atom-julia-client.

cdsousa avatar cdsousa commented on August 12, 2024

Let me add that displaying the results of each cell inline, right before the next cell division, would be awesome and would make Atom work more like a notebook. I guess that is harder from a technical perspective though.

from atom-julia-client.

sglyon avatar sglyon commented on August 12, 2024

I like the idea of cells, good suggestion.

But I also don't want my editor to become a notebook so I don't know that I'm on board with holding all results to the bottom of each cell. Given that we don't have a harsh of a visual break between cells (like the notebook does) I think it would be confusing to collect results at cell breaks

from atom-julia-client.

pfitzseb avatar pfitzseb commented on August 12, 2024

Yeah, I think I'd prefer the results to stay inline, i.e. have the cell-evaluation work like manually evaling all lines in the cell instead of working like the eval file command.

from atom-julia-client.

nilshg avatar nilshg commented on August 12, 2024

Maybe a compromise would be to have cell Eval when evaluating the cell division line, and line eval for all other lines?

from atom-julia-client.

sglyon avatar sglyon commented on August 12, 2024

I think that another keybindings for cell eval is fine to distinguish
between line and cell eval. The discussion above was about where cell eval
output should go.

// Spencer
On Nov 5, 2015 7:11 PM, "Nils" [email protected] wrote:

Maybe a compromise would be to have cell Eval when evaluating the cell
division line, and line eval for all other lines?


Reply to this email directly or view it on GitHub
#63 (comment)
.

from atom-julia-client.

pfitzseb avatar pfitzseb commented on August 12, 2024

Once atom/atom#9930 lands, we could easily implement @cdsousa's suggestion (along with a setting to switch to sequential inline evaluation of all lines in the cell).

from atom-julia-client.

CarloLucibello avatar CarloLucibello commented on August 12, 2024

atom/atom#9930 has been merged

from atom-julia-client.

ChrisRackauckas avatar ChrisRackauckas commented on August 12, 2024

Would this be a good time to revive this?

from atom-julia-client.

cdsousa avatar cdsousa commented on August 12, 2024

I've just noticed that Hydrogen now supports this (just search for "cell" in the page).
It uses a syntax I'm not a big fan, but maybe if this gets implemented here it would be good to be compatible.

from atom-julia-client.

dgleich avatar dgleich commented on August 12, 2024

Just wanted to add some kudos here! This is great to have!

from atom-julia-client.

ChrisRackauckas avatar ChrisRackauckas commented on August 12, 2024

Should this be closed now?

from atom-julia-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.