Skip to content

Commit

Permalink
Format files using DocumentFormat
Browse files Browse the repository at this point in the history
  • Loading branch information
davidanthoff authored and github-actions[bot] committed Jul 27, 2024
1 parent 6613ed2 commit b22f0b6
Show file tree
Hide file tree
Showing 8 changed files with 105 additions and 109 deletions.
10 changes: 5 additions & 5 deletions src/DAPRPC/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ struct DAPError <: Exception
msg::AbstractString
end

mutable struct DAPEndpoint{IOIn <: IO,IOOut <: IO}
mutable struct DAPEndpoint{IOIn<:IO,IOOut<:IO}
pipe_in::IOIn
pipe_out::IOOut

Expand All @@ -21,7 +21,7 @@ mutable struct DAPEndpoint{IOIn <: IO,IOOut <: IO}
seq::Int
end

DAPEndpoint(pipe_in, pipe_out, err_handler = nothing) =
DAPEndpoint(pipe_in, pipe_out, err_handler=nothing) =
DAPEndpoint(pipe_in, pipe_out, Channel{Any}(Inf), Channel{Any}(Inf), Dict{String,Channel{Any}}(), err_handler, :idle, nothing, nothing, 0)

function write_transport_layer(stream, response)
Expand Down Expand Up @@ -166,9 +166,9 @@ function send_request(x::DAPEndpoint, method::AbstractString, params)

response = take!(response_channel)

if response["success"]=="true"
if response["success"] == "true"
return response["body"]
elseif response["success"]=="false"
elseif response["success"] == "false"
error_message = response["message"]
throw(DAPError(error_message))
else
Expand All @@ -184,7 +184,7 @@ function get_next_message(endpoint::DAPEndpoint)
return msg
end

function Base.iterate(endpoint::DAPEndpoint, state = nothing)
function Base.iterate(endpoint::DAPEndpoint, state=nothing)
check_dead_endpoint!(endpoint)

try
Expand Down
10 changes: 5 additions & 5 deletions src/DAPRPC/interface_def.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ end

function field_allows_missing(field::Expr)
field.head == :(::) && field.args[2] isa Expr &&
field.args[2].head == :curly && field.args[2].args[1] == :Union &&
any(i -> i == :Missing, field.args[2].args)
field.args[2].head == :curly && field.args[2].args[1] == :Union &&
any(i -> i == :Missing, field.args[2].args)
end

function field_type(field::Expr, typename::String)
Expand Down Expand Up @@ -55,9 +55,9 @@ macro dict_readable(arg)
$((arg))

$(count_real_fields > 0 ? :(
function $tname(; $((get_kwsignature_for_field(field) for field in arg.args[3].args if !(field isa LineNumberNode))...))
$tname($((field.args[1] for field in arg.args[3].args if !(field isa LineNumberNode))...))
end
function $tname(; $((get_kwsignature_for_field(field) for field in arg.args[3].args if !(field isa LineNumberNode))...))
$tname($((field.args[1] for field in arg.args[3].args if !(field isa LineNumberNode))...))
end
) : nothing)

function $tname(dict::Dict)
Expand Down
6 changes: 3 additions & 3 deletions src/DAPRPC/typed.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ end
# so that we get an error in the typecast at the end of `send`
# if that is not the case.
typed_res(res, TR::Type{Nothing}) = res
typed_res(res, TR::Type{<:T}) where {T <: AbstractArray{Any}} = T(res)
typed_res(res, TR::Type{<:T}) where {T<:AbstractArray{Any}} = T(res)
typed_res(res, TR::Type{<:AbstractArray{T}}) where T = T.(res)
typed_res(res, TR::Type) = TR(res)

Expand Down Expand Up @@ -58,7 +58,7 @@ end
function dispatch_msg(x::DAPEndpoint, dispatcher::MsgDispatcher, msg)
dispatcher._currentlyHandlingMsg = true
try
method_name, request_type = if msg["type"] == "request"
method_name, request_type = if msg["type"] == "request"
msg["command"], :request
elseif msg["type"] == "event"
msg["event"], :event
Expand All @@ -81,7 +81,7 @@ function dispatch_msg(x::DAPEndpoint, dispatcher::MsgDispatcher, msg)
param_type(msg[request_type == :request ? "arguments" : "body"])
end
elseif param_type <: NamedTuple
convert(param_type,(;(Symbol(i[1])=>i[2] for i in msg[request_type == :request ? "arguments" : "body"])...))
convert(param_type, (; (Symbol(i[1]) => i[2] for i in msg[request_type == :request ? "arguments" : "body"])...))
else
param_type(msg[request_type == :request ? "arguments" : "body"])
end
Expand Down
32 changes: 14 additions & 18 deletions src/DebugEngines.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ mutable struct DebugEngine

next_cmd::Channel{Any}

frame::Union{Nothing, JuliaInterpreter.Frame}
frame::Union{Nothing,JuliaInterpreter.Frame}

expr_splitter::Union{JuliaInterpreter.ExprSplitter,Nothing}

Expand All @@ -31,13 +31,9 @@ mutable struct DebugEngine
mod,
code,
filename,
stop_on_entry,

Channel{Any}(Inf),
nothing,
stop_on_entry, Channel{Any}(Inf),
nothing,

JuliaInterpreter.finish_and_return!,
nothing, JuliaInterpreter.finish_and_return!,
String[],
Set{Any}(),
nothing,
Expand All @@ -48,7 +44,7 @@ mutable struct DebugEngine
end
end

function get_obj_by_accessor(accessor, super = nothing)
function get_obj_by_accessor(accessor, super=nothing)
parts = split(accessor, '.')
@assert length(parts) > 0
top = popfirst!(parts)
Expand Down Expand Up @@ -80,8 +76,8 @@ function get_obj_by_accessor(accessor, super = nothing)
return nothing
end

function toggle_mode_for_all_submodules(mod, compiled, seen = Set())
for name in names(mod; all = true)
function toggle_mode_for_all_submodules(mod, compiled, seen=Set())
for name in names(mod; all=true)
if isdefined(mod, name)
obj = getfield(mod, name)
if obj !== mod && obj isa Module && !(obj in seen)
Expand Down Expand Up @@ -117,7 +113,7 @@ function set_compiled_functions_modules!(debug_engine::DebugEngine, items::Vecto
@debug "setting as compiled" items = items

# sort inputs once so that removed items are at the end
sort!(items, lt = function (a, b)
sort!(items, lt=function (a, b)
am = startswith(a, '-')
bm = startswith(b, '-')

Expand Down Expand Up @@ -313,7 +309,7 @@ function Base.run(debug_engine::DebugEngine)
elseif JuliaInterpreter.shouldbreak(debug_engine.frame, debug_engine.frame.pc)
debug_engine.on_stop(StopReasonBreakpoint)
else
put!(debug_engine.next_cmd, (cmd = :continue,))
put!(debug_engine.next_cmd, (cmd=:continue,))
end


Expand Down Expand Up @@ -387,7 +383,7 @@ function Base.run(debug_engine::DebugEngine)
end

function terminate(debug_engine::DebugEngine)
put!(debug_engine.next_cmd, (cmd = :stop,))
put!(debug_engine.next_cmd, (cmd=:stop,))
end

function set_function_breakpoints!(debug_engine::DebugEngine, breakpoints)
Expand All @@ -411,23 +407,23 @@ function set_compiled_mode!(debug_engine::DebugEngine, compiled_mode::Bool)
end

function execution_continue(debug_engine::DebugEngine)
put!(debug_engine.next_cmd, (cmd = :continue,))
put!(debug_engine.next_cmd, (cmd=:continue,))
end

function execution_next(debug_engine::DebugEngine)
put!(debug_engine.next_cmd, (cmd = :next,))
put!(debug_engine.next_cmd, (cmd=:next,))
end

function execution_step_in(debug_engine::DebugEngine, target_id)
put!(debug_engine.next_cmd, (cmd = :stepIn, targetId = target_id))
put!(debug_engine.next_cmd, (cmd=:stepIn, targetId=target_id))
end

function execution_step_out(debug_engine::DebugEngine)
put!(debug_engine.next_cmd, (cmd = :stepOut,))
put!(debug_engine.next_cmd, (cmd=:stepOut,))
end

function execution_terminate(debug_engine::DebugEngine)
put!(debug_engine.next_cmd, (cmd = :stop,))
put!(debug_engine.next_cmd, (cmd=:stop,))
end

function has_source(debug_engine::DebugEngine, filename::AbstractString)
Expand Down
Loading

0 comments on commit b22f0b6

Please sign in to comment.