Skip to content

Commit 5b1f78b

Browse files
committed
add easycomplete lua load mojos
1 parent 3de5c89 commit 5b1f78b

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

lua/easycomplete.lua

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,26 @@ function EasyComplete.typing(...)
7373
})
7474
end
7575

76+
-- 执行每个模块里的 init_once 方法
77+
function EasyComplete.load_mojo(mojos)
78+
if vim.g.easycomplete_lua_mojos_loaded == 1 then
79+
return
80+
end
81+
vim.g.easycomplete_lua_mojos_loaded = 1
82+
for i, mojo in ipairs(mojos) do
83+
local mojo_name = "easycomplete." .. mojo
84+
local Mo = require(mojo_name)
85+
Mo.init_once()
86+
end
87+
end
88+
7689
-- 初始化入口
7790
function EasyComplete.init()
78-
TabNine.init_once()
79-
GhostText.init_once()
80-
LuaSnip.init_once()
81-
Cmdline.init_once()
91+
EasyComplete.load_mojo({"tabnine", "ghost_text", "luasnip", "cmdline"})
92+
-- TabNine.init_once()
93+
-- GhostText.init_once()
94+
-- LuaSnip.init_once()
95+
-- Cmdline.init_once()
8296

8397
nvim_lsp_handler()
8498
if vim.api.nvim_get_var('easycomplete_kindflag_buf') == "" and debug == true then

0 commit comments

Comments
 (0)