Skip to content
Closed
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
13 changes: 13 additions & 0 deletions lua/blink/cmp/sources/lsp/hacks/clangd.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
local clangd = {}
local completion_item_kind = require('blink.cmp.types').CompletionItemKind

--- @param text string
--- @return string
local function strip_ending_punctuation(text)
local last_char = text:sub(-1)
if last_char == '>' or last_char == '"' then text = text:sub(1, -2) end
return text
end

--- @param response blink.cmp.CompletionResponse | nil
--- @return blink.cmp.CompletionResponse | nil
Expand All @@ -9,6 +18,10 @@ function clangd.process_response(response)
if not items then return response end

for _, item in ipairs(items) do
if item.kind == completion_item_kind.File then
item.textEdit.newText = strip_ending_punctuation(item.textEdit.newText)
item.label = strip_ending_punctuation(item.label)
end
item.lsp_score = item.score
end
return response
Expand Down
Loading