-
-
Notifications
You must be signed in to change notification settings - Fork 293
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Stop button is almost there!
- Loading branch information
Showing
11 changed files
with
433 additions
and
218 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,9 +2,10 @@ name = "Pluto" | |
uuid = "c3e4b0f8-55cb-11ea-2926-15256bba5781" | ||
license = "MIT" | ||
authors = ["Fons van der Plas <[email protected]>", "MikoΕaj Bochenski <[email protected]>"] | ||
version = "0.4.3" | ||
version = "0.5.0" | ||
|
||
[deps] | ||
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b" | ||
HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3" | ||
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" | ||
Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,26 @@ | ||
using UUIDs | ||
|
||
|
||
"The building block of `Notebook`s. Contains both code and output." | ||
mutable struct Cell | ||
"because Cells can be reordered, they get a UUID. The JavaScript frontend indexes cells using the UUID." | ||
uuid::UUID | ||
code::String | ||
parsedcode::Any | ||
output::Any | ||
output_repr::Union{String, Nothing} | ||
error_repr::Union{String, Nothing} | ||
repr_mime::MIME | ||
runtime::Union{Missing,UInt64} | ||
errormessage::Any | ||
symstate::SymbolsState | ||
resolved_funccalls::Set{Symbol} | ||
resolved_symstate::SymbolsState | ||
module_usings::Set{Expr} | ||
end | ||
|
||
Cell(uuid, code) = Cell(uuid, code, nothing, nothing, missing, nothing, SymbolsState(), Set{Symbol}(), SymbolsState(), Set{Expr}()) | ||
Cell(uuid, code) = Cell(uuid, code, nothing, nothing, nothing, MIME("text/plain"), missing, SymbolsState(), Set{Symbol}(), SymbolsState(), Set{Expr}()) | ||
|
||
"Turn a `Cell` into an object that can be serialized using `JSON.json`, to be sent to the client." | ||
function serialize(cell::Cell) | ||
Dict(:uuid => string(cell.uuid), :code => cell.code)# , :output => cell.output) | ||
end | ||
|
||
createcell_fromcode(code::String) = Cell(uuid1(), code) | ||
|
||
function relay_output!(cell::Cell, output::Any) | ||
cell.output = output | ||
cell.errormessage = nothing | ||
end | ||
|
||
function relay_error!(cell::Cell, message::String) | ||
cell.output = nothing | ||
cell.errormessage = message | ||
Dict(:uuid => string(cell.uuid), :code => cell.code) | ||
end | ||
|
||
relay_error!(cell::Cell, err::Exception) = relay_error!(cell, sprint(showerror, err)) | ||
function relay_error!(cell::Cell, err::Exception, backtrace::Array{Base.StackTraces.StackFrame,1}) | ||
until = findfirst(sf -> sf.func == :run_single!, backtrace) | ||
backtrace_trimmed = until === nothing ? backtrace : backtrace[1:until-1] | ||
relay_error!(cell, sprint(showerror, err, backtrace_trimmed)) | ||
end | ||
createcell_fromcode(code::String) = Cell(uuid1(), code) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
1d9e7e0
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.
#38
1d9e7e0
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.
#34
1d9e7e0
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.
@JuliaRegistrator register()
1d9e7e0
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.
Registration pull request created: JuliaRegistries/General/11850
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via: