Sitelet https://github.com/Exafunction/windsurf.nvim/pull/264
Skip to content

feat: Add blink.cmp completion source - #264

Merged
saranshsaini merged 4 commits into
Exafunction:mainfrom
aliaksandr-trush:blink
Apr 22, 2025
Merged

saranshsaini merged 4 commits into
Exafunction:mainfrom
aliaksandr-trush:blink

Conversation

@aliaksandr-trush

Copy link
Copy Markdown
Contributor

blink.cmp: https://github.com/Saghen/blink.cmp

Created on top of PR #251

@glawe

glawe commented Nov 22, 2024 •

Copy link
Copy Markdown

Lovely. Can't wait to until this one is merged!

xiaket added a commit to xiaket/codeium.nvim that referenced this pull request Nov 29, 2024
@aliaksandr-trush
aliaksandr-trush force-pushed the blink branch 2 times, most recently from ea755ec to a7e226e Compare December 21, 2024 09:39
@aliaksandr-trush

Copy link
Copy Markdown
Contributor Author

Updated PR according to changes in v0.8.0 release: https://github.com/Saghen/blink.cmp/tree/v0.8.0

@wojtekgalaj

Copy link
Copy Markdown

Come on Santa! This will look awesome under my tree.

@aliaksandr-trush
aliaksandr-trush force-pushed the blink branch 3 times, most recently from e72afbc to d0431b4 Compare December 25, 2024 19:48
@justicenyaga

Copy link
Copy Markdown

Apparently you can add nvim-cmp sources such as codeium to blink.cmp using blink.compat. Here's the link to blink compact

@icefed

icefed commented Jan 10, 2025

Copy link
Copy Markdown

Apparently you can add nvim-cmp sources such as codeium to blink.cmp using blink.compat. Here's the link to blink compact

maybe something wrong, blink compact not works for me.

  {
    "Exafunction/codeium.nvim",
    dependencies = {
      "nvim-lua/plenary.nvim",
    },
    config = function()
      require("codeium").setup({
        enable_cmp_source = false,
        virtual_text = {
          enabled = true,
        }
      })
    end
  },
-- blink-cmp
        default = { 'lsp', 'path', 'snippets', 'buffer', 'emoji', 'codeium' },
        providers = {
          emoji = {
            module = "blink-emoji",
            name = "Emoji",
            score_offset = 15,        -- Tune by preference
            opts = { insert = true }, -- Insert emoji (default) or complete its name
          },
          codeium = {
            score_offset = 3,
            name = "codeium",
            module = 'blink.compat.source',
          },
        },

@Davenchy

Davenchy commented Jan 10, 2025 •

Copy link
Copy Markdown

maybe something wrong, blink compact not works for me.

Set enable_cmp_source to true

This is my config and it works for me.

  {
    "Exafunction/codeium.nvim",
    event = "BufEnter",
    dependencies = { "nvim-lua/plenary.nvim" },
    opts = {
      enable_chat = true,
    },
  },
return {
  "saghen/blink.cmp",
  dependencies = {
    "rafamadriz/friendly-snippets",
    "moyiz/blink-emoji.nvim",
    "mikavilpas/blink-ripgrep.nvim",
    "saghen/blink.compat",
  },
  version = "*",

  ---@module 'blink.cmp'
  ---@type blink.cmp.Config
  opts = {
    keymap = { preset = "enter", cmdline = { preset = "enter" } },
    appearance = {
      use_nvim_cmp_as_default = true,
      -- Set to 'mono' for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
      -- Adjusts spacing to ensure icons are aligned
      nerd_font_variant = "normal",
    },
    completion = {
      keyword = { range = "full" },
      list = {
        selection = function(ctx)
          return ctx.mode == "cmdline" and "auto_insert" or "preselect"
        end,
      },
      documentation = {
        window = { border = "rounded" },
        --   auto_show = true,
        --   auto_show_delay_ms = 500,
      },
      menu = {
        border = "rounded",
        draw = {
          columns = {
            { "label", "label_description", gap = 1 },
            { "kind_icon", "kind" },
          },
        },
      },
      ghost_text = { enabled = true },
    },
    -- Default list of enabled providers defined so that you can extend it
    -- elsewhere in your config, without redefining it, due to `opts_extend`
    sources = {
      default = {
        "codeium",
        "lazydev",
        "lsp",
        "path",
        "snippets",
        "buffer",
        "ripgrep",
        "emoji",
      },
      providers = {
        codeium = {
          name = "codeium",
          module = "blink.compat.source",
        },
        lazydev = {
          name = "LazyDev",
          module = "lazydev.integrations.blink",
          score_offset = 100,
        },
        emoji = {
          name = "Emoji",
          module = "blink-emoji",
        },
        ripgrep = {
          name = "Ripgrep",
          module = "blink-ripgrep",
        },
      },
    },
    signature = { enabled = true, window = { border = "rounded" } },
  },
  opts_extend = { "sources.default" },
}

In Rust projects, the following error message keeps appearing:

Error executing lua callback: ...are/nvim/lazy/blink.cmp/lua/blink/cmp/lib/text_edits.lua:91: index out of range
stack traceback:
	[C]: in function '_str_byteindex_enc'
	...are/nvim/lazy/blink.cmp/lua/blink/cmp/lib/text_edits.lua:91: in function 'get_line_byte_from_position'
	...are/nvim/lazy/blink.cmp/lua/blink/cmp/lib/text_edits.lua:146: in function 'to_utf_8'
	...are/nvim/lazy/blink.cmp/lua/blink/cmp/lib/text_edits.lua:130: in function 'get_from_item'
	...link.cmp/lua/blink/cmp/completion/windows/ghost_text.lua:70: in function 'draw_preview'
	...link.cmp/lua/blink/cmp/completion/windows/ghost_text.lua:33: in function <...link.cmp/lua/blink/cmp/completion/windows/ghost_text.lua:32>
Error executing lua callback: ...are/nvim/lazy/blink.cmp/lua/blink/cmp/lib/text_edits.lua:91: index out of range
stack traceback:
	[C]: in function '_str_byteindex_enc'
	...are/nvim/lazy/blink.cmp/lua/blink/cmp/lib/text_edits.lua:91: in function 'get_line_byte_from_position'
	...are/nvim/lazy/blink.cmp/lua/blink/cmp/lib/text_edits.lua:146: in function 'to_utf_8'
	...are/nvim/lazy/blink.cmp/lua/blink/cmp/lib/text_edits.lua:130: in function 'get_from_item'
	...link.cmp/lua/blink/cmp/completion/windows/ghost_text.lua:70: in function 'draw_preview'
	...link.cmp/lua/blink/cmp/completion/windows/ghost_text.lua:33: in function <...link.cmp/lua/blink/cmp/completion/windows/ghost_text.lua:32>

Update:
Disabling ghost_text resolved the issue, and the error no longer appears.

@icefed

icefed commented Jan 11, 2025

Copy link
Copy Markdown

@Davenchy 😂
i forgot enable_cmp_source, it works now, thanks.

@hkhrithik007

Copy link
Copy Markdown

mine idk it works or not but it dosnt show codeium icon or any blank icon
both
Screenshot 2025-02-16 at 4 40 00 PM

@hkhrithik007

Copy link
Copy Markdown

but i dont think its working as it dosnt show any suggestions

@aemonge

aemonge commented Feb 17, 2025

Copy link
Copy Markdown

No merge yet ?

@cxwx

cxwx commented Apr 16, 2025 •

Copy link
Copy Markdown

waiting for merge

Add possibility to enable/disable Codeium completion
simplify Server implementation by using OOP style. Now it's better work
with LSPs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants