File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -4,8 +4,12 @@ local if_nil = utils.if_nil
44local M = {}
55
66
7+ --- @param win integer
8+ --- @param opts table<string , any> ?
79function M .apply_winopts (win , opts )
8- if not opts then return end
10+ if not opts then
11+ return
12+ end
913 assert (
1014 type (opts ) == ' table' ,
1115 ' winopts must be a table, not ' .. type (opts ) .. ' : ' .. vim .inspect (opts )
Original file line number Diff line number Diff line change @@ -515,6 +515,8 @@ function M.builder(widget)
515515end
516516
517517
518+ --- @param expr nil | string | fun (): string
519+ --- @return string
518520local function eval_expression (expr )
519521 local mode = api .nvim_get_mode ()
520522 if mode .mode == ' v' then
@@ -544,12 +546,14 @@ local function eval_expression(expr)
544546 expr = expr or ' <cexpr>'
545547 if type (expr ) == " function" then
546548 return expr ()
547- elseif type ( expr ) == " string " then
549+ else
548550 return vim .fn .expand (expr )
549551 end
550552end
551553
552554
555+ --- @param expr nil | string | fun (): string
556+ --- @param winopts table<string , any> ?
553557function M .hover (expr , winopts )
554558 local value = eval_expression (expr )
555559 local view = M .builder (M .expression )
@@ -623,6 +627,7 @@ function M.preview(expr, opts)
623627 .new_win (new_preview_win )
624628 .build ()
625629 view .open (value )
630+ view .__expression = value
626631 return view
627632end
628633
You can’t perform that action at this time.
0 commit comments