Saghen / blink.compat

Compatibility layer for using nvim-cmp sources on blink.cmp
MIT License
51 stars 3 forks source link

compatibility with `supermaven-nvim` (indent issue) #14

Open theol0403 opened 3 days ago

theol0403 commented 3 days ago

Make sure you have done the following

Bug Description

Supermaven's suggestions seem to expect nvim-cmp to clear the line before inserting the suggestion. For this reason, indentation can double up when accepting the suggestion.

Cmp: image

Blink: image

Relevant configuration

{
  "saghen/blink.cmp",
  opts = {
    sources = {
      compat = { "supermaven" },
    },
    windows = {
      autocomplete = {
        selection = "auto_insert",
      },
    },
  },
  dependencies = {
    "saghen/blink.compat",
    {
      "supermaven-inc/supermaven-nvim",
      opts = {
        keymaps = {
          accept_suggestion = nil,
        },
        disable_inline_completion = true,
      },
    },
  },
},

neovim version

NVIM v0.10.2 Build type: Release LuaJIT 2.1.1713484068 Run "nvim -V1 -v" for more info

blink.cmp version: branch, tag, or commit

v0.6.1

blink.compat version: branch, tag, or commit

0f368c3

theol0403 commented 3 days ago

Something else I noticed:

stefanboca commented 3 days ago

@theol0403 I believe I know what the issue is. Could you try mannually pinning blink.cmp to 0.5.0 and blink.compat to 0bb4b68e8f09d66ca69f482c6aa782c0f643829b to see if that works?

@Saghen it looks like supermaven expects the regular completion to continue after execute, which as I understand is different to how blink handles execute. Is this something that could be made configurable by the source (ex by introducing opts into the callback parameters)?

For reference, it looks like nvim-cmp always calls execute after completion is finished, and it's not used to allow the source to handle accepting its completion itself.

theol0403 commented 3 days ago

@stefanboca thank you for the reply! unfortunately, I am having trouble downgrading blink.cmp... I am within the LazyVim environment, and while downgrading is possible, there are breaking changes in LazyVim's configuration... and when completely resetting LazyVim's default configuration... supermaven (or LSP for that matter) no longer work out of the box.

I can try to keep debugging a fresh install of blink.cmp outside of the LazyVim context but I am unsure if it is worth the time given that you seem to understand the issue.

Saghen commented 1 day ago

@stefanboca Just pushed the change on main, it'll run the execute function after applying

stefanboca commented 1 day ago

@theol0403 could you check if you still have the same issue?

@sagehen thanks, just saw this. Unrelated but right before I saw this I merged #15 and released v1.0.1 which accidentally included 6d914f7396cf026f04156266a5b134a25cbbca97, so there might be some slight incompatibility until the next release of blink.cmp.

Saghen commented 1 day ago

Reverted the commit and made a new release without it, should be all good now, thanks for noticing

theol0403 commented 1 day ago

@Saghen @stefanboca thanks for the work on this!

With auto_insert, the behavior is now improved -- cycling the selections maintains proper indentation! However, hitting accept cancels the entire suggestion and reverts to an empty line.

Similarly, without auto_insert, hitting accept simply closes the completion window without inserting the selected suggestion.