From e1c6a2a30caa33b069b58271e377272a983d57ec Mon Sep 17 00:00:00 2001 From: tim3nd Date: Fri, 6 Dec 2024 00:09:58 +0800 Subject: [PATCH 1/2] fix(render): not render two separator for doc window Some LSP servers like lua_ls would return `---` for function doc, so the manually added separator would make two separator in doc window. --- lua/blink/cmp/lib/window/docs.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lua/blink/cmp/lib/window/docs.lua b/lua/blink/cmp/lib/window/docs.lua index f546ef37..230e3a8d 100644 --- a/lua/blink/cmp/lib/window/docs.lua +++ b/lua/blink/cmp/lib/window/docs.lua @@ -24,9 +24,12 @@ function docs.render_detail_and_documentation(bufnr, detail, documentation, max_ detail_lines, doc_lines = docs.extract_detail_from_doc(detail_lines, doc_lines) 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 - vim.list_extend(combined_lines, doc_lines) + local doc_already_has_separator = #doc_lines > 1 and (doc_lines[1] == '---' or doc_lines[1] == '***') + if #detail_lines > 0 and #doc_lines > 0 then table.insert(combined_lines, '') end + -- skip original separator in doc_lines, so we can highlight it later + vim.list_extend(combined_lines, doc_lines, doc_already_has_separator and 2 or 1) vim.api.nvim_buf_set_lines(bufnr, 0, -1, true, combined_lines) vim.api.nvim_set_option_value('modified', false, { buf = bufnr }) From b3be3a664e6209e65c87ff37b6517fc0356240a8 Mon Sep 17 00:00:00 2001 From: tim3nd Date: Fri, 6 Dec 2024 02:10:30 +0800 Subject: [PATCH 2/2] doc: update default highlight group --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7521c9d2..189e75fd 100644 --- a/README.md +++ b/README.md @@ -679,12 +679,14 @@ MiniDeps.add({ | `BlinkCmpScrollBarThumb` | PmenuThumb | The scrollbar thumb | | `BlinkCmpScrollBarGutter` | PmenuSbar | The scrollbar gutter | | `BlinkCmpLabel` | Pmenu | Label of the completion item | -| `BlinkCmpLabelDeprecated` | Comment | Deprecated label of the completion item | +| `BlinkCmpLabelDeprecated` | NonText | Deprecated label of the completion item | | `BlinkCmpLabelMatch` | Pmenu | (Currently unused) Label of the completion item when it matches the query | +| `BlinkCmpLabelDetail` | NonText | Label description of the completion item | +| `BlinkCmpLabelDescription` | NonText | Label description of the completion item | | `BlinkCmpKind` | Special | Kind icon/text of the completion item | | `BlinkCmpKind` | Special | Kind icon/text of the completion item | | `BlinkCmpSource` | NonText | Source of the completion item | -| `BlinkCmpGhostText` | Comment | Preview item with ghost text | +| `BlinkCmpGhostText` | NonText | Preview item with ghost text | | `BlinkCmpDoc` | NormalFloat | The documentation window | | `BlinkCmpDocBorder` | NormalFloat | The documentation window border | | `BlinkCmpDocSeparator` | NormalFloat | The documentation separator between doc and detail |