@@ -37,8 +37,8 @@ function M.maybe_block(block)
3737 end
3838end
3939
40- function M .send_files (files , stdin )
41- if # files < 1 and # stdin < 1 then
40+ function M .send_files (files , stdin , quickfix )
41+ if # files < 1 and # stdin < 1 and # quickfix < 1 then
4242 return
4343 end
4444
@@ -57,6 +57,7 @@ function M.send_files(files, stdin)
5757 response_pipe = server ,
5858 guest_cwd = cwd ,
5959 stdin = stdin ,
60+ quickfix = quickfix ,
6061 argv = vim .v .argv ,
6162 force_block = force_block ,
6263 }
@@ -146,9 +147,13 @@ function M.init(host_pipe)
146147 :totable ()
147148 nfiles = # files
148149
150+ local quickfix = vim .iter (vim .api .nvim_list_bufs ()):find (function (buf )
151+ return vim .bo [buf ].filetype == " quickfix"
152+ end )
153+
149154 -- No arguments, user is probably opening a nested session intentionally
150155 -- Or only piping input from stdin
151- if nfiles < 1 then
156+ if nfiles < 1 and not quickfix then
152157 local should_nest , should_block = config .nest_if_no_args , false
153158
154159 if config .callbacks .no_files then
@@ -176,7 +181,28 @@ function M.init(host_pipe)
176181 M .maybe_block (should_block )
177182 end
178183
179- M .send_files (files , {})
184+ quickfix = vim
185+ .iter (vim .fn .getqflist ())
186+ :map (function (old )
187+ return {
188+ filename = vim .api .nvim_buf_get_name (old .bufnr ),
189+ module = old .module ,
190+ lnum = old .lnum ,
191+ end_lnum = old .end_lnum ,
192+ col = old .col ,
193+ end_col = old .end_col ,
194+ vcol = old .vcol ,
195+ nr = old .nr ,
196+ text = old .text ,
197+ pattern = old .pattern ,
198+ type = old .type ,
199+ valid = old .valid ,
200+ user_data = old .user_data ,
201+ }
202+ end )
203+ :totable ()
204+
205+ M .send_files (files , {}, quickfix )
180206 end ,
181207 })
182208end
0 commit comments