From 18ba402c9a59501ebdb2e1471f31c723d1b08876 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20F=2E=20Bortl=C3=ADk?= Date: Thu, 4 Sep 2025 02:07:21 +0200 Subject: [PATCH 1/2] feat: show command help in Snacks picker preview --- lua/uv/init.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lua/uv/init.lua b/lua/uv/init.lua index f19a0ab..e3c93c2 100644 --- a/lua/uv/init.lua +++ b/lua/uv/init.lua @@ -528,6 +528,14 @@ function M.setup_pickers() { text = "uv init", desc = "Initialize a new project" }, } end, + preview = function(ctx) + local cmd = ctx.item.text:match("^(uv %a+)") + if cmd then + Snacks.picker.preview.cmd(cmd .. " --help", ctx) + else + ctx.preview:set_lines({}) + end + end, format = function(item) return { { item.text .. " - " .. item.desc } } end, From 2a2c25d803c10880456c83bacef5ee1234ae8914 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 1 Feb 2026 04:54:44 +0000 Subject: [PATCH 2/2] Add tests for Snacks picker preview feature (PR #10) https://claude.ai/code/session_013v2gegRsXqKmoQKnZjiZdn --- tests/uv_spec.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/uv_spec.lua b/tests/uv_spec.lua index 5b9c7f9..0328fd3 100644 --- a/tests/uv_spec.lua +++ b/tests/uv_spec.lua @@ -121,4 +121,19 @@ describe("uv.nvim", function() assert.are.equal("function", type(_G.run_command)) end) end) + + describe("snacks picker preview", function() + local pattern = "^(uv %a+)" + + it("extracts uv commands for help preview", function() + assert.are.equal("uv add", ("uv add [package]"):match(pattern)) + assert.are.equal("uv sync", ("uv sync --all-extras"):match(pattern)) + assert.are.equal("uv init", ("uv init"):match(pattern)) + end) + + it("returns nil for non-uv items", function() + assert.is_nil(("Run current file"):match(pattern)) + assert.is_nil(("Run selection"):match(pattern)) + end) + end) end)