feat: Major improvements in API. Particularly relating to entries.

This commit is contained in:
TJ DeVries
2020-09-03 23:56:49 -04:00
parent 737363097b
commit 839f57efb3
13 changed files with 690 additions and 216 deletions

View File

@@ -42,23 +42,32 @@ function actions.goto_file_selection(prompt_bufnr)
print("[telescope] Nothing currently selected")
return
else
local value = entry.value
if not value then
print("Could not do anything with blank line...")
return
local filename, row, col
if entry.filename then
filename = entry.filename
-- TODO: Check for off-by-one
row = entry.row or entry.lnum
col = entry.col
else
-- TODO: Might want to remove this and force people
-- to put stuff into `filename`
local value = entry.value
if not value then
print("Could not do anything with blank line...")
return
end
if type(value) == "table" then
value = entry.display
end
local sections = vim.split(value, ":")
filename = sections[1]
row = tonumber(sections[2])
col = tonumber(sections[3])
end
-- TODO: This is not great.
if type(value) == "table" then
value = entry.display
end
local sections = vim.split(value, ":")
local filename = sections[1]
local row = tonumber(sections[2])
local col = tonumber(sections[3])
vim.cmd(string.format([[bwipeout! %s]], prompt_bufnr))
a.nvim_set_current_win(picker.original_win_id or 0)