Shougo / ddu-kind-file

File kind for ddu.vim
MIT License
25 stars 9 forks source link

Location list support #1

Closed jrudess closed 2 years ago

jrudess commented 2 years ago

Sometime back I submitted a pull-request which added location-list support for denite. I've started making the same update for ddu in a commit located at https://github.com/jrudess/ddu-kind-file/commit/613bd03f9d3f459dbfe1ae09680bf2c4da4fc555

With Denite, I retrieved the window number using the following API:

  wininfo = self._vim.call('denite#helper#_get_wininfo')
  self.vim.call('setloclist', wininfo['winnr'], qfloclist)

Do you have a similar API for ddu? For now I've just got a hard-coded constant buffer number.

  // TODO: Need correct buffer number
  const winnr = await fn.bufwinnr(args.denops, 1);
  await fn.setloclist(args.denops, winnr, qfloclist, " ");
Shougo commented 2 years ago

Hm. The winnr should be 0. Because, 0 means current window and denite#helper#_get_wininfo() just returns current window info.

jrudess commented 2 years ago

In the denite implementation, I appear to be getting unique window numbers if I launch denite from different windows. My test case is two vertically split windows. I can run different denite grep's from each, and load the result to separate location-lists and the 2nd grep doesn't overwrite the location-list contents of the 1st grep. So I think this means that _get_wininfo is returning the correct window number where denite was originally started from.

jrudess commented 2 years ago

I misunderstood how the vim call works. You are correct, and using winnr = 0 does exactly what I want.