Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions lib/debug/server_dap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,11 @@ def register_vars vars, tid
end

class ThreadClient
def value_inspect obj
# TODO: max length should be configuarable?
DEBUGGER__.safe_inspect obj, short: true, max_length: 4 * 1024
end

def process_dap args
# pp tc: self, args: args
type = args.shift
Expand Down Expand Up @@ -706,7 +711,7 @@ def process_dap args
case obj
when Hash
vars = obj.map{|k, v|
variable(DEBUGGER__.safe_inspect(k), v,)
variable(value_inspect(k), v,)
}
when Struct
vars = obj.members.map{|m|
Expand Down Expand Up @@ -816,7 +821,7 @@ def process_dap args

begin
v = b.local_variable_get(w)
detail ="(variable: #{DEBUGGER__.safe_inspect(v)})"
detail ="(variable: #{value_inspect(v)})"
rescue NameError
end

Expand Down Expand Up @@ -853,7 +858,7 @@ def evaluate_result r
v = variable nil, r
v.delete :name
v.delete :value
v[:result] = DEBUGGER__.safe_inspect(r)
v[:result] = value_inspect(r)
v
end

Expand All @@ -868,7 +873,7 @@ def variable_ name, obj, indexedVariables: 0, namedVariables: 0
ivnum = M_INSTANCE_VARIABLES.bind_call(obj).size

{ name: name,
value: DEBUGGER__.safe_inspect(obj),
value: value_inspect(obj),
type: (klass = M_CLASS.bind_call(obj)).name || klass.to_s,
variablesReference: vid,
indexedVariables: indexedVariables,
Expand Down