File tree Expand file tree Collapse file tree 3 files changed +15
-9
lines changed Expand file tree Collapse file tree 3 files changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -60,13 +60,14 @@ function M.insert(_)
60
60
--- @type MatchEntry
61
61
local entry = action_state .get_selected_entry ()
62
62
63
- -- Link to the filename by default
64
- local destination = entry .value .file .filename
65
-
66
- -- Link to a specific heading if is set
67
- if entry .value .headline then
68
- destination = org .get_link_to_headline (entry .value .headline )
69
- end
63
+ local destination = (function ()
64
+ if entry .value .headline then
65
+ -- Link to a specific heading if is set
66
+ return org .get_link_to_headline (entry .value .headline )
67
+ else
68
+ return org .get_link_to_file (entry .value .file )
69
+ end
70
+ end )()
70
71
71
72
org .insert_link (destination )
72
73
return true
Original file line number Diff line number Diff line change 1
- local config = require (' telescope-orgmode.config' )
2
1
local to_actions = require (' telescope-orgmode.actions' )
3
2
4
3
local M = {}
Original file line number Diff line number Diff line change 31
31
--- @param headline OrgApiHeadline
32
32
--- @return string
33
33
function M .get_link_to_headline (headline )
34
- return OrgApi .get_link_to_headline (headline ._section ) --- @diagnostic disable-line : invisible
34
+ return OrgApi .get_link_to_headline (headline )
35
+ end
36
+
37
+ --- @param file OrgApiFile
38
+ --- @return string
39
+ function M .get_link_to_file (file )
40
+ return OrgApi .get_link_to_file (file )
35
41
end
36
42
37
43
function M .insert_link (destination )
You can’t perform that action at this time.
0 commit comments