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
19 changes: 17 additions & 2 deletions lib/debug/server_dap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,20 @@ def show_protocol dir, msg
end
end

@local_fs = false

def self.local_fs
@local_fs
end

def self.local_fs_set
@local_fs = true
end

def dap_setup bytes
CONFIG.set_config no_color: true
@seq = 0
UI_DAP.local_fs_set if self.kind_of?(UI_UnixDomainServer)

show_protocol :>, bytes
req = JSON.load(bytes)
Expand Down Expand Up @@ -211,10 +222,12 @@ def process
when 'launch'
send_response req
@is_attach = false
UI_DAP.local_fs_set if req.dig('arguments', 'localfs')
when 'attach'
send_response req
Process.kill(UI_ServerBase::TRAP_SIGNAL, Process.pid)
@is_attach = true
UI_DAP.local_fs_set if req.dig('arguments', 'localfs')
when 'setBreakpoints'
path = args.dig('source', 'path')
SESSION.clear_line_breakpoints path
Expand Down Expand Up @@ -498,7 +511,7 @@ def process_protocol_request req
when 'source'
ref = req.dig('arguments', 'sourceReference')
if src = @src_map[ref]
@ui.respond req, content: src.join
@ui.respond req, content: src.join("\n")
else
fail_response req, message: 'not found...'
end
Expand Down Expand Up @@ -597,7 +610,9 @@ def process_dap args
event! :dap_result, :backtrace, req, {
stackFrames: @target_frames.map{|frame|
path = frame.realpath || frame.path
ref = frame.file_lines unless path && File.exist?(path)
if !UI_DAP.local_fs || !(path && File.exist?(path))
ref = frame.file_lines
end

{
# id: ??? # filled by SESSION
Expand Down