@@ -33,6 +33,16 @@ M.show = function()
3333
3434 local line = 0
3535
36+ if state .threads_filter ~= " " then
37+ local filter = " "
38+ filter = filter .. state .threads_filter
39+ if state .threads_filter_invert then
40+ filter = filter .. " "
41+ end
42+ api .nvim_buf_set_lines (state .bufnr , line , line , true , { filter })
43+ line = line + 1
44+ end
45+
3646 for k , thread in pairs (session .threads ) do
3747 local is_stopped_thread = session .stopped_thread_id == thread .id
3848 local thread_name = is_stopped_thread and thread .name .. " " or thread .name
@@ -79,7 +89,19 @@ M.show = function()
7989 end
8090 )
8191
82- local content = vim .iter (frames )
92+ local filtered_frames = vim .iter (frames )
93+ :filter (
94+ --- @param f { label : string , id : number }
95+ function (f )
96+ local match = f .label :match (state .threads_filter )
97+ local invert = state .threads_filter_invert
98+ local inv_match = invert and not match and not state .threads_filter ~= " "
99+ return inv_match or (not invert and match )
100+ end
101+ )
102+ :totable ()
103+
104+ local content = vim .iter (filtered_frames )
83105 :map (
84106 --- @param f { label : string , id : number }
85107 function (f )
@@ -90,7 +112,7 @@ M.show = function()
90112
91113 api .nvim_buf_set_lines (state .bufnr , line , line + # content , false , content )
92114
93- for i , f in pairs (frames ) do
115+ for i , f in pairs (filtered_frames ) do
94116 local first_pipe_pos = string.find (f .label , " |" )
95117 assert (first_pipe_pos , " missing pipe, buffer may have been edited" )
96118
0 commit comments