|
1 | 1 | describe("peekstack.commands", function() |
2 | 2 | local commands = require("peekstack.commands") |
3 | 3 | local config = require("peekstack.config") |
| 4 | + local peekstack = require("peekstack") |
4 | 5 | local persist = require("peekstack.persist") |
5 | 6 | local original_list_sessions = nil |
6 | 7 | local original_select = nil |
@@ -135,15 +136,37 @@ describe("peekstack.commands", function() |
135 | 136 | assert.equals("alpha: 0 items (updated: formatted-time)", prompts[2]) |
136 | 137 | end) |
137 | 138 |
|
138 | | - it("includes extended providers in quick peek completion", function() |
139 | | - commands.setup() |
| 139 | + it("uses registered providers for quick peek completion", function() |
| 140 | + peekstack.setup({}) |
140 | 141 | local names = vim.fn.getcompletion("PeekstackQuickPeek ", "cmdline") |
141 | 142 |
|
142 | 143 | assert.is_true(vim.list_contains(names, "lsp.declaration")) |
143 | 144 | assert.is_true(vim.list_contains(names, "lsp.symbols_document")) |
144 | 145 | assert.is_true(vim.list_contains(names, "diagnostics.in_buffer")) |
| 146 | + assert.is_false(vim.list_contains(names, "marks.buffer")) |
| 147 | + assert.is_false(vim.list_contains(names, "marks.global")) |
| 148 | + assert.is_false(vim.list_contains(names, "marks.all")) |
| 149 | + end) |
| 150 | + |
| 151 | + it("reflects provider registration changes in quick peek completion", function() |
| 152 | + peekstack.setup({ |
| 153 | + providers = { |
| 154 | + marks = { |
| 155 | + enable = true, |
| 156 | + }, |
| 157 | + }, |
| 158 | + }) |
| 159 | + |
| 160 | + local names = vim.fn.getcompletion("PeekstackQuickPeek ", "cmdline") |
145 | 161 | assert.is_true(vim.list_contains(names, "marks.buffer")) |
146 | 162 | assert.is_true(vim.list_contains(names, "marks.global")) |
147 | 163 | assert.is_true(vim.list_contains(names, "marks.all")) |
| 164 | + |
| 165 | + peekstack.register_provider("custom.test", function(_ctx, cb) |
| 166 | + cb({}) |
| 167 | + end) |
| 168 | + |
| 169 | + names = vim.fn.getcompletion("PeekstackQuickPeek ", "cmdline") |
| 170 | + assert.is_true(vim.list_contains(names, "custom.test")) |
148 | 171 | end) |
149 | 172 | end) |
0 commit comments