Skip to content

Commit 4611e3a

Browse files
committed
"exclude <file>" command added
1 parent 9cbd7d2 commit 4611e3a

File tree

2 files changed

+42
-4
lines changed

2 files changed

+42
-4
lines changed

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

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ def execute
1313
file = realpath(file)
1414

1515
if Command.file_fiter_supported?
16-
Debugger.file_filter.add(file)
17-
print_dir_included(file)
16+
Debugger.file_filter.include(file)
17+
print_file_included(file)
1818
else
1919
print_debug("file filter is not supported")
2020
end
@@ -27,7 +27,41 @@ def help_command
2727

2828
def help(cmd)
2929
%{
30-
file-filter include file - adds dir to list of included dirs
30+
include file - adds file/dir to file filter (either remove already excluded or add as included)
31+
}
32+
end
33+
end
34+
end
35+
36+
class ExcludeFile < Command # :nodoc:
37+
self.control = true
38+
39+
def regexp
40+
/ ^\s*exclude\s+(.+?)\s*$/x
41+
end
42+
43+
def execute
44+
file = @match[1]
45+
46+
return if file.nil?
47+
file = realpath(file)
48+
49+
if Command.file_fiter_supported?
50+
Debugger.file_filter.exclude(file)
51+
print_file_excluded(file)
52+
else
53+
print_debug("file filter is not supported")
54+
end
55+
end
56+
57+
class << self
58+
def help_command
59+
'include'
60+
end
61+
62+
def help(cmd)
63+
%{
64+
exclude file - exclude file/dir from file filter (either remove already included or add as exclude)
3165
}
3266
end
3367
end

lib/ruby-debug-ide/xml_printer.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,14 @@ def print_variable(name, value, kind)
184184
CGI.escapeHTML(name), kind, CGI.escapeHTML(safe_to_string(value)))
185185
end
186186

187-
def print_dir_included(file)
187+
def print_file_included(file)
188188
print("<fileIncluded file=\"%s\"/>", file)
189189
end
190190

191+
def print_file_excluded(file)
192+
print("<fileExcluded file=\"%s\"/>", file)
193+
end
194+
191195
def print_breakpoints(breakpoints)
192196
print_element 'breakpoints' do
193197
breakpoints.sort_by{|b| b.id }.each do |b|

0 commit comments

Comments
 (0)