-
-
Notifications
You must be signed in to change notification settings - Fork 415
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fixes for 0.7 #671
fixes for 0.7 #671
Conversation
Julia 0.7 changed the `String()` constructor to deplete `Vector{UInt8}` arguments, so we must `copy()` them first to avoid clobbering.
add build.log to .gitignore
src/inline.jl
Outdated
@@ -1,6 +1,9 @@ | |||
import Base: display, redisplay | |||
|
|||
immutable InlineDisplay <: Display end | |||
@static if !isdefined(Base, :AbstractDisplay) # remove when Compat.jl#482 is merged and tagged |
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.
Shouldn't this be:
if !isdefined(Base, :AbstractDisplay) && !isdefined(Compat, :AbstractDisplay)
...
(No need for @static
in global scope unless the expressions have ccall
or macros...)
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.
Actually, this if statement can be deleted completely as the AbstractDisplay
definition was tagged in Compat v0.52.0
Great, thanks for working on this! Sorry I haven't had time to bang on it. Do things like |
Pushed one more deprecation fix and updated to use
Yes! 🎉 |
src/stdio.jl
Outdated
logger = Base.CoreLogging._global_logstate.logger | ||
|
||
# Override logging if it's pointing at the default stderr | ||
if logger.stream == Base.stderr |
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.
Actually, there is something bugged here; this is only true on the first call, don't we need to reset it somewhere @staticfloat ? On this branch; with a @show logger.stream == Base.stderr
inserted:
julia> using IJulia
julia> mktemp() do path, io
redirect_stderr(IJulia.IJuliaStdio(io, "stderr")) do
@warn("warn")
end
flush(io)
seek(io, 0)
@show read(io, String)
end
logger.stream == Base.stderr = true
read(io, String) = "\e[33m\e[1m┌ \e[22m\e[39m\e[33m\e[1mWarning: \e[22m\e[39mwarn\n\e[33m\e[1m└ \e[22m\e[39m\e[90m@ Main REPL[2]:3\e[39m\n"
"\e[33m\e[1m┌ \e[22m\e[39m\e[33m\e[1mWarning: \e[22m\e[39mwarn\n\e[33m\e[1m└ \e[22m\e[39m\e[90m@ Main REPL[2]:3\e[39m\n"
julia> mktemp() do path, io
redirect_stderr(IJulia.IJuliaStdio(io, "stderr")) do
@warn("warn")
end
flush(io)
seek(io, 0)
@show read(io, String)
end
logger.stream == Base.stderr = false
read(io, String) = ""
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.
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.
Would it not be simpler to just replace the global logger instead of checking the internal state?
src/handlers.jl
Outdated
@@ -138,7 +138,7 @@ function complete_request(socket, msg) | |||
|
|||
codestart = find_parsestart(code, cursorpos) | |||
comps, positions = Base.REPLCompletions.completions(code[codestart:end], cursorpos-codestart+1) |
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.
Probably need:
if VERSION < v"0.7.0-DEV.3500" # julia#25544
import Base: REPLCompletions
else
import REPL: REPLCompletions
end
above so that we can just call this as REPLCompletions.completions
with no deprecation warning.
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.
Thanks, there was a similar if VERSION
check at the top so I added the imports there.
While trying the tab-completion for deprecations I got this
Seems to be a bug here Lines 144 to 145 in 90b0165
|
Maybe should be (Or maybe we should use |
src/handlers.jl
Outdated
comps, positions = Base.REPLCompletions.completions(code[codestart:end], cursorpos-codestart+1) | ||
positions += codestart-1 | ||
comps, positions = REPLCompletions.completions(code[codestart:end], cursorpos-codestart+1) | ||
positions = positions .+ codestart-1 |
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.
Nevermind, it is this fix that is missing a .
on the -
and the range turned into an array. Of course last works for an empty range.
src/handlers.jl
Outdated
comps, positions = Base.REPLCompletions.completions(code[codestart:end], cursorpos-codestart+1) | ||
positions += codestart-1 | ||
comps, positions = REPLCompletions.completions(code[codestart:end], cursorpos-codestart+1) | ||
positions = positions .+ codestart .- 1 |
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.
Hmm, still not correct; this returns a Vector
on Julia 0.6.
- warn() -> at-warn - emtpy try-catch - remove_destination -> force - start -> firstindex - endof -> lastindex - broadcast +
LGTM, ready to merge? |
@@ -198,7 +202,7 @@ function clear_history(indices) | |||
end | |||
|
|||
# since a range could be huge, intersect it with 1:n first | |||
clear_history{T<:Integer}(r::AbstractRange{T}) = | |||
clear_history(r::AbstractRange{T}) where {T<:Integer} = |
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.
Can just be clear_history(r::AbstractRange{<:Integer})
since we don't use T
.
@@ -58,30 +56,50 @@ const displayqueue = Any[] | |||
|
|||
# remove x from the display queue | |||
function undisplay(x) | |||
i = findfirst(equalto(x), displayqueue) | |||
if i > 0 | |||
i = findfirst(isequal(x), displayqueue) |
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.
Shouldn't this be Compat.findfirst
to get the version that returns nothing
on 0.6? Then you can drop the i > 0
check.
function show_bt(io::IO, top_func::Symbol, t, set) | ||
# follow PR #17570 code in removing top_func from backtrace | ||
eval_ind = findlast(addr->Base.REPL.ip_matches_func(addr, top_func), t) | ||
eval_ind != 0 && (t = t[1:eval_ind-1]) | ||
eval_ind = findlast(addr->ip_matches_func(addr, top_func), t) |
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.
Similar to above, use Compat.findlast
and then you can skip the eval_ind != 0
check.
I'm just going to merge this as-is so that people can use IJulia with 0.7, and then add more fixes in another PR. |
Thanks! I have to admit that I did not review the changes from #623 myself. |
This is #623 + #667 + two additional fixes. Closes #661, #654, #637.
This PR works locally on both 0.7 and 0.6 for me, would be great to get IJulia to work properly on 0.7!