Skip to content

Commit a253b35

Browse files
authored
fix(documentation): better docs (#234)
* fix: check that signature.win is not nil * feat(documentation): don't show item detail if it is part of the item documentation * style: comment
1 parent b2bbef5 commit a253b35

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

lua/blink/cmp/windows/documentation.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ function docs.update_position()
111111
or config.direction_priority.autocomplete_south
112112

113113
-- remove the direction priority of the signature window if it's open
114-
if signature.win:is_open() then
114+
if signature.win and signature.win:is_open() then
115115
direction_priority = vim.tbl_filter(
116116
function(dir) return dir ~= (autocomplete_win_is_up and 's' or 'n') end,
117117
direction_priority

lua/blink/cmp/windows/lib/docs.lua

+7
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ function docs.render_detail_and_documentation(bufnr, detail, documentation, max_
1717
end
1818
end
1919

20+
-- don't show the detail if it's part of the documentation
21+
local detail_str = table.concat(detail_lines, '\n')
22+
local doc_str = table.concat(doc_lines, '\n')
23+
if doc_str:find(detail_str, 1, true) then
24+
detail_lines = {}
25+
end
26+
2027
local combined_lines = vim.list_extend({}, detail_lines)
2128
-- add a blank line for the --- separator
2229
if #detail_lines > 0 and #doc_lines > 0 then table.insert(combined_lines, '') end

0 commit comments

Comments
 (0)