Skip to content

Commit

Permalink
fix(notify): only show once per session
Browse files Browse the repository at this point in the history
  • Loading branch information
xzbdmw committed Jan 5, 2025
1 parent e94d055 commit 7489b5c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ formatting = {
format = function(entry, vim_item)
local highlights_info = require("colorful-menu").cmp_highlights(entry)

-- if highlight_info==nil, which means missing ts parser, let's fallback to use default `vim_item.abbr`.
-- if highlight_info==nil, which means missing ts parser, let's fallback to use default `vim_item.abbr`.
-- What this plugin offers is two fields: `vim_item.abbr_hl_group` and `vim_item.abbr`.
if highlights_info ~= nil then
vim_item.abbr_hl_group = highlights_info.highlights
Expand Down
14 changes: 9 additions & 5 deletions lua/colorful-menu/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -156,16 +156,20 @@ function M.blink_highlights(ctx)
return nil
end

local i = 0
---@param completion_item lsp.CompletionItem
---@param ls string?
---@return CMHighlights?
function M.highlights(completion_item, ls)
if ls == vim.bo.filetype then
vim.notify(
"colorful-menu.nvim: Integration with nvim-cmp or blink.cmp has been simplified, and legacy per-filetype options is also deprecated"
.. " to prefer per-language-server options, please see README",
vim.log.levels.WARN
)
if i == 0 then
vim.notify(
"colorful-menu.nvim: Integration with nvim-cmp or blink.cmp has been simplified, and legacy per-filetype options is also deprecated"
.. " to prefer per-language-server options, please see README",
vim.log.levels.WARN
)
i = i + 1
end
return nil
end
if completion_item == nil or ls == nil or ls == "" or vim.b.ts_highlight == false then
Expand Down

0 comments on commit 7489b5c

Please sign in to comment.