Skip to content

Commit 88f71b1

Browse files
committed
fix: add union to utils
1 parent 957a57a commit 88f71b1

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

lua/blink/cmp/utils.lua

+16
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,22 @@ function utils.shallow_copy(t)
1212
return t2
1313
end
1414

15+
--- Returns the union of the keys of two tables
16+
--- @generic T
17+
--- @param t1 T[]
18+
--- @param t2 T[]
19+
--- @return T[]
20+
function utils.union_keys(t1, t2)
21+
local t3 = {}
22+
for k, _ in pairs(t1) do
23+
t3[k] = true
24+
end
25+
for k, _ in ipairs(t2) do
26+
t3[k] = true
27+
end
28+
return vim.tbl_keys(t3)
29+
end
30+
1531
--- Determines whether the current buffer is a "special" buffer
1632
--- @return boolean
1733
function utils.is_special_buffer()

0 commit comments

Comments
 (0)