Clean up the mess from the previous commit

This commit is contained in:
2026-06-24 02:48:40 +03:00
parent da84043692
commit c098084842
2 changed files with 11 additions and 74 deletions

View File

@@ -11,20 +11,6 @@ return {
---@type blink.cmp.Config
opts = {
snippets = { preset = 'luasnip' },
-- snippets = {
-- expand = function(snippet)
-- require('luasnip').lsp_expand(snippet)
-- end,
-- active = function(filter)
-- if filter and filter.direction then
-- return require('luasnip').jumpable(filter.direction)
-- end
-- return require('luasnip').in_snippet()
-- end,
-- jump = function(direction)
-- require('luasnip').jump(direction)
-- end,
-- },
keymap = {
preset = 'enter',
['<C-e>'] = {},
@@ -38,7 +24,16 @@ return {
function(cmp)
local item = cmp.get_selected_item()
-- NOTE(kyren): a bunch of annoying hacky stuff that basically takes a thing
-- like "foo.unw|" and turns it into "foo.unwrap|" by adding only the "rap"
-- part, then expands this with luasnip to the full completion.
-- Because I have auto_insert set to false it means blink doesn't insert the
-- actual .unwrap and even when selecting it, it just exapnds it without
-- inserting it into the actual buffer, so the solution for me was to just
-- add it, then manually expand it by hijacking this function.
if item and item.label == '.unwrap' then
-- I think it must be schedule so it doesn't happen immediately but on the
-- next "tick", so blink doesn't explain
vim.schedule(function()
local ctx = cmp.get_context()
if not ctx or not ctx.bounds then
@@ -211,7 +206,7 @@ return {
},
opts_extend = { 'sources.default' },
-- TODO: pressing backk (deleting), should re-show completion menu
-- TODO: pressing back (deleting), should re-show completion menu
}
-- From LazyVim

View File

@@ -66,11 +66,11 @@ return {
trig = '.unwrap',
}, {
f(function(_, parent)
-- Use POSTFIX_MATCH instead of LS_TSMATCH
local match = parent.snippet.env.LS_TSMATCH
-- vim.notify('postfix: "' .. vim.inspect(match) .. '"')
if not match then
vim.notify('warning empty unwrap', vim.log.levels.WARN)
return { 'unwrap()' }
end
@@ -84,64 +84,6 @@ return {
return vim.split(wrapped, '\n', { plain = true })
end),
}),
-- ts_postfix({
-- trig = 'unwrap',
-- matchTSNode = {
-- query = [[
-- (field_access
-- object: (
-- field_access
-- method_invocation
-- identifier
-- ) @my_object
-- ) @my_field
-- ]],
-- query_lang = 'java',
-- select = 'longest',
-- },
-- }, {
-- f(function(_, parent)
-- -- Use POSTFIX_MATCH instead of LS_TSMATCH
-- local match = parent.snippet.env.POSTFIX_MATCH
-- vim.notify('postfix: "' .. vim.inspect(match) .. '"')
--
-- if not match then
-- return { 'unwrap()' }
-- end
--
-- -- If LuaSnip provides the match as a table, concat it
-- if type(match) == 'table' then
-- match = table.concat(match, '\n')
-- end
--
-- -- Format the string
-- local wrapped = string.format('unwrap(%s)', match)
--
-- -- Split it back into a table of strings to safely handle any newlines
-- return vim.split(wrapped, '\n', { plain = true })
-- end),
-- }, { condition = require('luasnip.util.util').yes }),
})
-- postfix({ trig = 'unwrap', match_pattern = [[[%w%.%_%-%"%']+$]] }, {
-- f(function(_, parent)
-- local match = parent.snippet.env.POSTFIX_MATCH
-- if match == nil then
-- return 'bunger'
-- end
-- -- match = match:sub(1, -2)
-- return 'unwrap(' .. match .. ')'
-- end, {}),
-- }, { condition = require('luasnip.util.util').yes }),
-- postfix({ trig = '.unwrap', snippetType = 'snippet' }, {
-- f(function(_, parent)
-- local match = parent.snippet.env.POSTFIX_MATCH
-- if match == nil then
-- return 'bunger'
-- end
-- return '[' .. match .. ']'
-- end, {}),
-- }),
end,
}