You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I used to do this in nvim-cmp with some function logic on the enable option like this:
local context = require("cmp.config.context")
...stuff....
disabled = disabled or context.in_treesitter_capture("comment")
...stuff...
return not disabled
I'm trying to recreate this for blink but I can't seem to detect a comment. I've got this so far:
return {
"saghen/blink.cmp",
opts = {
keymap = {
preset = "default",
},
enabled = function()
local node = vim.treesitter.get_node()
local disabled = false
disabled = disabled or (vim.tbl_contains({ "markdown" }, vim.bo.filetype))
disabled = disabled or (vim.bo.buftype == "prompt")
disabled = disabled or (node and string.find(node:type(), "comment"))
return not disabled
end,
},
}
The:
node and string.find(node:type(), "comment")
doesn't seem to work correctly. And enabled doesn't seem to fire for every treesitter context change.
Is there a way to do this?
I'm using blink via LazyVim if that makes a difference.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I used to do this in
nvim-cmp
with some function logic on theenable
option like this:I'm trying to recreate this for blink but I can't seem to detect a comment. I've got this so far:
The:
doesn't seem to work correctly. And
enabled
doesn't seem to fire for every treesitter context change.Is there a way to do this?
I'm using blink via LazyVim if that makes a difference.
Beta Was this translation helpful? Give feedback.
All reactions