Skip to content

Commit

Permalink
Fix handling for missing values.
Browse files Browse the repository at this point in the history
  • Loading branch information
gcv committed Feb 5, 2024
1 parent d36653b commit ce6994a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

- Make `julia-snail-repl-completion-at-point` try to work even when not connected to Snail ([#142](https://github.com/gcv/julia-snail/pull/142)).
- Fix returning `missing` values ([#143](https://github.com/gcv/julia-snail/issues/143)).


## [1.3.1] — 2024-01-17
Expand Down
14 changes: 7 additions & 7 deletions JuliaSnail.jl
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ struct Params
end

function format(obj, width, height)
if obj == nothing
if isnothing(obj)
return ""
end
io = IOBuffer()
Expand Down Expand Up @@ -255,11 +255,11 @@ function eval_tmpfile(tmpfile, modpath, realfile, linenum,
# linenum - 1 accounts for the leading "begin" line in tmpfiles
expr_change_lnn(exprs, realfilesym, linenum - 1)
result = eval_in_module(modpath, exprs)
if Conf.repl_display_eval_results && result != nothing
if Conf.repl_display_eval_results && !isnothing(result)
println()
@info "Module $modpath\n$result"
end
if popup_params == nothing
if isnothing(popup_params)
Main.JuliaSnail.elexpr(true)
else
Main.JuliaSnail.elexpr((
Expand Down Expand Up @@ -304,7 +304,7 @@ Return a name split into its module and identifier components.
Example: given a string like "Base.Math.acos", return [Base.Math, "acos"].
"""
function split_name(name::String, ns::Module=Main)
if match(r"\.", name) == nothing
if isnothing(match(r"\.", name))
return [ns, name]
end
components = match(r"(.*?)\.(.*)", name)
Expand Down Expand Up @@ -431,7 +431,7 @@ function apropos(ns, pattern)
names = lsnames(ns, all=true, imported=true, include_modules=false, recursive=true, pattern=pattern)
# lazy load Base
global apropos_cached_base
if apropos_cached_base == nothing
if isnothing(apropos_cached_base)
apropos_cached_base = lsnames(Main.Base, all=false, imported=true, include_modules=true, recursive=true, prepend_ns=true)
end
base_filtered = filter(
Expand All @@ -440,7 +440,7 @@ function apropos(ns, pattern)
append!(names, base_filtered)
# lazy load Core
global apropos_cached_core
if apropos_cached_core == nothing
if isnothing(apropos_cached_core)
apropos_cached_core = lsnames(Main.Core, all=false, imported=true, include_modules=true, recursive=true, prepend_ns=true)
end
core_filtered = filter(
Expand Down Expand Up @@ -980,7 +980,7 @@ has multiple entries, send_to_client will prompt the user at the REPL to select
which client should receive the message.
"""
function send_to_client(expr, client_socket=nothing)
if client_socket == nothing
if isnothing(client_socket)
if isempty(client_sockets)
throw("No client connections available")
elseif 1 == length(client_sockets)
Expand Down

0 comments on commit ce6994a

Please sign in to comment.