Skip to content

Commit 5e3b668

Browse files
committed
"file-filter on|off" command added
1 parent 47e01e2 commit 5e3b668

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

lib/ruby-debug-ide/commands/file_filtering.rb

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,42 @@ def help(cmd)
6666
end
6767
end
6868
end
69+
70+
class FileFilterCommand < Command # :nodoc:
71+
self.control = true
72+
73+
def regexp
74+
/ ^\s*file-filter\s+(on|off)\s*$/x
75+
end
76+
77+
def execute
78+
action = @match[1]
79+
80+
if Command.file_filter_supported?
81+
if 'on' == action
82+
Debugger.file_filter.enable
83+
print_file_filter_status(true)
84+
elsif 'off' == action
85+
Debugger.file_filter.disable
86+
print_file_filter_status(false)
87+
else
88+
print_error "Unknown option '#{action}'"
89+
end
90+
else
91+
print_debug("file filter is not supported")
92+
end
93+
end
94+
95+
class << self
96+
def help_command
97+
'file-filter'
98+
end
99+
100+
def help(cmd)
101+
%{
102+
file-filter (on|off) - enable/disable file filtering
103+
}
104+
end
105+
end
106+
end
69107
end

lib/ruby-debug-ide/xml_printer.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,10 @@ def print_file_excluded(file)
192192
print("<fileExcluded file=\"%s\"/>", file)
193193
end
194194

195+
def print_file_filter_status(status)
196+
print("<fileFilter status=\"%s\"/>", status)
197+
end
198+
195199
def print_breakpoints(breakpoints)
196200
print_element 'breakpoints' do
197201
breakpoints.sort_by{|b| b.id }.each do |b|

0 commit comments

Comments
 (0)