@@ -2,11 +2,14 @@ local backends = require("aerial.backends")
22local config = require (" aerial.config" )
33local data = require (" aerial.data" )
44local highlight = require (" aerial.highlight" )
5+ local navigation = require (" aerial.navigation" )
6+
57local M = {}
68--- @module ' snacks.picker'
79
810--- @param opts ? snacks.picker.Config
911M .pick_symbol = function (opts )
12+ local winid = vim .api .nvim_get_current_win ()
1013 local bufnr = vim .api .nvim_get_current_buf ()
1114 local filename = vim .api .nvim_buf_get_name (bufnr )
1215 local backend = backends .get ()
@@ -49,7 +52,7 @@ M.pick_symbol = function(opts)
4952 last [parent ] = snack_item
5053 snack_item .last = true
5154 end
52- if item == position .closest_symbol then
55+ if position and item == position .closest_symbol then
5356 default_selection_index = (# items + 1 )
5457 end
5558 table.insert (items , snack_item )
@@ -61,6 +64,12 @@ M.pick_symbol = function(opts)
6164 sort = {
6265 fields = { " idx" },
6366 },
67+ actions = {
68+ confirm = function (picker , item )
69+ picker :close ()
70+ navigation .select_symbol (item .item , winid , bufnr , { jump = true })
71+ end ,
72+ },
6473 format = function (item , picker )
6574 --- @type aerial.Symbol
6675 local symbol = item .item
0 commit comments