blink.cmp icon indicating copy to clipboard operation
blink.cmp copied to clipboard

Feeding in a character / set of characters after completion is done

Open balpert89 opened this issue 2 months ago • 0 comments

Feature Description

Hi,

thanks for this awesome work.

My use case is the following: when accepting an item from the completion list, based on the key I have used for accepting I would like to add a certain (set of) character(s) to the item.

An example in go:

A struct has the following fields:

type MyType struct {
    IntField int
    SliceField []string
}

Pseudo code

func main() {
    m := MyType{ IntField: 3, SliceField: []string{"a","b"}
    m.
}

Now the completion menu is triggered, showing

IntField Field
SliceField Field

Assume I have the following keymaps:

keymap = {
  ["<CR>"] = { "select_and_accept", "fallback" },
  ["."] = { {"select_and_accept_with_char", "."}, "fallback" }, -- this does not exist, just showing what I am attending to achieve
  ["["] = { {"select_and_accept_with_char", "[", "]"}, "fallback" }, -- this does not exist, just showing what I am attending to achieve
}

And further then accepting item IntField with the key .. The code will now show

func main() {
    m := MyType{ IntField: 3, SliceField: []string{"a","b"}
    m.IntField.
}

Or accepting item SliceField with the key [. The code would show

func main() {
    m := MyType{ IntField: 3, SliceField: []string{"a","b"} }
    m.SliceField[]
}

Is this currently possible?

balpert89 avatar Dec 13 '24 21:12 balpert89