Juno provides some functionality using Atom's UI, which will usually have a fallback for use in other environments.
The isactive()
function will provide an interface for figuring out whether the current session is running within Juno:
Juno.isactive
— Function
isactive() -> Bool
Will return true
when the current Julia process is connected to a running Juno frontend.
Juno.jl includes features which allow package developers to create enhanced displays in Juno.
For example, we can print provide structured display for arbitrary objects (similar to Base.dump
)
Juno.structure
— Function
structure(x)
Display x
's underlying representation, rather than using its normal display method.
For example, structure(:(2x+1))
displays the Expr
object with its head
and args
fields instead of printing the expression.
Profiles collected by Profile.@profile
can be displayed as a flame chart (similar to ProfileView.jl
) inside of Juno by calling Juno.profiler
. There's also a Juno.@profiler
macro which does the same as Profile.@profile
but also displays the collected information as a flame chart after clearing all the collected backtraces beforehand. Just using the Juno.@profiler
macro will be enough for most cases, and it's way much simpler.
Juno.profiler
— Function
profiler(data=Profile.fetch(); lidict=nothing, C=false, combine=true, recur=:off, pruned=[])
Show profile information as an in-editor flamechart. Any keyword argument that FlameGraphs.flamegraph
can take could be given.
Juno.@profiler
— Macro
@profiler exp [kwargs...]
Clear currently collected profile traces, profile the provided expression and show it via Juno.profiler()
.
Any keyword argument that FlameGraphs.flamegraph
can take could be given as optional arugments kwargs...
# profile a function call
@profiler fname(fargs)
# include ccalls and compress recursive calls
@profiler fname(fargs) C = true recur = :flat
Clicking on one of the boxes in the profile view will take you to the corresponding file/line. The width of the boxes in the profile view and the length of the lines in the editor correspond to the percentage of calls made in that line. Also note that there are specially colored lines:
To clear the profile view and the in-editor display, click the Forget Plot
button in the profile view toolbar or use Julia Client: Clear Profile
command.
Juno.jl allows package developers to use the progress bar which is provided in the Atom window. For example, you can easily show a progress meter for a for
loop or a comprehension via the command:
@progress for ...
The following functions provide this interface:
Juno.@progress
— Macro
@progress [name="", threshold=0.005] for i = ..., j = ..., ...
@progress [name="", threshold=0.005] x = [... for i = ..., j = ..., ...]
Show a progress meter named name
for the given loop or array comprehension if possible. Update frequency is limited by threshold
(one update per 0.5% of progress by default).
Juno.progress
— Function
progress(f::Function; name = "", msg = "")
Evaluates f
with id
as its argument and makes sure to destroy the progress bar afterwards. To update the progress bar in f
you can call a logging statement like @info
or even just @logmsg
with _id=id
and progress
as arguments.
progress
can take either of the following values:
0 <= progress < 1
: create or update progress barprogress == nothing || progress = NaN
: set progress bar to indeterminate progressprogress >= 1 || progress == "done"
: destroy progress barThe logging message (e.g. "foo"
in @info "foo"
) will be used as the progress bar's name.
Juno.progress() do id
for i = 1:10
sleep(0.5)
@info "iterating" progress=i/10 _id=id
end
end
It is recommended to either use the @progress
macro or the
progress(name = "Foo") do p
end
notation to ensure that the progress bars are properly unregistered in the frontend.
InteractionJuno.jl lets package developers interact with users via the Atom frontend.
Juno.selector
allows the user to select from a list of options:
Juno.selector
— Function
selector([xs...]) -> x
Allow the user to select one of the xs
.
xs
should be an iterator of strings. Currently there is no fallback in other environments.
Juno.notify
sends an OS-level notification:
Juno.notify
— Function
notify(msg::AbstractString)
Display msg
as an OS specific notification.
Useful for signaling the end of a long running computation or similar. This disregards the Notifications
setting in julia-client
. Falls back to @info(msg)
in other environments.
Juno.notification
sends an notification via Atom's builtin notification API:
Juno.notification
— Function
notification(message::AbstractString; kind = :Info, options = Dict())
Adds an notification via Atom's builtin notification system. message
and options
serves same as described in NotificationManager
API, while kind
specifies which kind of notification will be used as follows:
atom.notifications[`add${kind}`](message, options)
Falls back to @info(message)
in other environments.
Juno.syntaxcolors
queries the currently used syntax colors in Atom (, which can be used to generate a plot theme or an OhMyREPL syntax theme from that, etc).
Juno.syntaxcolors
— Function
syntaxcolors(selectors = Atom.SELECTORS)::Dict{String, UInt32}
Get the colors used by the current Atom theme. selectors
should be a Dict{String, Vector{String}}
which assigns a css selector (e.g. syntax--julia
) to a name (e.g. variable
).
Plots.theme(:juno)
automatically create a plot theme based on your Atom syntax color, using this function internallyJuno.clearconsole
clears the Juno REPL:
Juno.clearconsole
— Function
clearconsole()
Clear the console if Juno is used; does nothing otherwise.
you can clear any Juno terminal via Ctrl-J Ctrl-C
(i.e. Julia Client: Clear REPL
command).
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.3