mirror of
https://github.com/zoriya/telescope.nvim.git
synced 2026-08-13 09:29:21 +00:00
feature: Vim help-tags picker (#117)
* feature: Vim help-tags picker * fix: filtered results were wrong because of missing `entry.value` * fix: filtered (Vim only help) items are listed in results as empty entries. * fix: avoid search history pollution by replacing / in cmd returned by taglist() with search() * fix: improve search() formatting * fix: escape tilde in search() command * fix: improve help-preview * fix: improve search() * fix: search() string fixes. * fix: use no magic to do magic Co-authored-by: TJ DeVries <devries.timothyj@gmail.com>
This commit is contained in:
co-authored by
TJ DeVries
parent
a38bb06e7d
commit
c3f9b25606
@@ -284,4 +284,53 @@ function make_entry.gen_from_treesitter(opts)
|
||||
end
|
||||
end
|
||||
|
||||
function make_entry.gen_from_tagfile(opts)
|
||||
local help_entry, version
|
||||
local delim = string.char(7)
|
||||
|
||||
local make_display = function(line)
|
||||
help_entry = ""
|
||||
display = ""
|
||||
version = ""
|
||||
|
||||
line = line .. delim
|
||||
for section in line:gmatch("(.-)" .. delim) do
|
||||
if section:find("^vim:") == nil then
|
||||
local ver = section:match("^neovim:(.*)")
|
||||
if ver == nil then
|
||||
help_entry = section
|
||||
else
|
||||
version = ver:sub(1, -2)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
result = {}
|
||||
if version ~= "" then -- some Vim only entries are unversioned
|
||||
if opts.show_version then
|
||||
result.display = string.format("%s [%s]", help_entry, version)
|
||||
else
|
||||
result.display = help_entry
|
||||
end
|
||||
result.value = help_entry
|
||||
end
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
return function(line)
|
||||
local entry = {
|
||||
entry_type = make_entry.types.GENERIC,
|
||||
|
||||
}
|
||||
local d = make_display(line)
|
||||
entry.valid = next(d) ~= nil
|
||||
entry.display = d.display
|
||||
entry.value = d.value
|
||||
entry.ordinal = d.value
|
||||
|
||||
return entry
|
||||
end
|
||||
end
|
||||
|
||||
return make_entry
|
||||
|
||||
Reference in New Issue
Block a user