Skip to content

Commit 643411a

Browse files
committed
feat(commands): complete quick peek providers dynamically
1 parent 580692c commit 643411a

2 files changed

Lines changed: 8 additions & 15 deletions

File tree

lua/peekstack/commands.lua

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -177,21 +177,7 @@ function M.setup()
177177
end, {
178178
nargs = "?",
179179
complete = function()
180-
return {
181-
"lsp.definition",
182-
"lsp.implementation",
183-
"lsp.references",
184-
"lsp.type_definition",
185-
"lsp.declaration",
186-
"lsp.symbols_document",
187-
"diagnostics.under_cursor",
188-
"diagnostics.in_buffer",
189-
"file.under_cursor",
190-
"grep.search",
191-
"marks.buffer",
192-
"marks.global",
193-
"marks.all",
194-
}
180+
return require("peekstack").list_providers()
195181
end,
196182
})
197183
end

lua/peekstack/init.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ function M.register_provider(name, fn)
4343
providers[name] = fn
4444
end
4545

46+
---@return string[]
47+
function M.list_providers()
48+
local names = vim.tbl_keys(providers)
49+
table.sort(names)
50+
return names
51+
end
52+
4653
---@param name string
4754
---@param fn PeekstackPicker
4855
function M.register_picker(name, fn)

0 commit comments

Comments
 (0)