Skip to content
This repository was archived by the owner on May 16, 2024. It is now read-only.

Commit 382e171

Browse files
fix: telescope issue when no matches (#60)
when there were no matches in the telescope search and the user pressed enter, we had a crash
1 parent 58239a5 commit 382e171

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

lua/nvim-devdocs/pickers.lua

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ local metadata_previewer = previewers.new_buffer_previewer({
4848

4949
local doc_previewer = previewers.new_buffer_previewer({
5050
title = "Preview",
51-
keep_last_buf = true,
5251
define_preview = function(self, entry)
5352
local bufnr = self.state.bufnr
5453

@@ -160,12 +159,14 @@ M.open_picker = function(entries, float)
160159
actions.close(prompt_bufnr)
161160

162161
local selection = action_state.get_selected_entry()
163-
local name = selection.value.name
164-
local match = name:match("%[([^%]]+)%]")
162+
if selection then
163+
local name = selection.value.name
164+
local match = name:match("%[([^%]]+)%]")
165165

166-
if match then plugin_state.set("current_doc", match) end
166+
if match then plugin_state.set("current_doc", match) end
167167

168-
open_doc(selection, float)
168+
open_doc(selection, float)
169+
end
169170
end)
170171
return true
171172
end,

0 commit comments

Comments
 (0)