Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(documentation): better docs #234

Merged
merged 3 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lua/blink/cmp/windows/documentation.lua
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function docs.update_position()
or config.direction_priority.autocomplete_south

-- remove the direction priority of the signature window if it's open
if signature.win:is_open() then
if signature.win and signature.win:is_open() then
direction_priority = vim.tbl_filter(
function(dir) return dir ~= (autocomplete_win_is_up and 's' or 'n') end,
direction_priority
Expand Down
7 changes: 7 additions & 0 deletions lua/blink/cmp/windows/lib/docs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ function docs.render_detail_and_documentation(bufnr, detail, documentation, max_
end
end

-- don't show the detail if it's part of the documentation
local detail_str = table.concat(detail_lines, '\n')
local doc_str = table.concat(doc_lines, '\n')
if doc_str:find(detail_str, 1, true) then
detail_lines = {}
end

local combined_lines = vim.list_extend({}, detail_lines)
-- add a blank line for the --- separator
if #detail_lines > 0 and #doc_lines > 0 then table.insert(combined_lines, '') end
Expand Down