Skip to content

Commit 04d201d

Browse files
benlubasvhyrro
authored andcommitted
feat(completion): allow custom completion engines
1 parent bb8e102 commit 04d201d

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

lua/neorg/modules/core/completion/module.lua

+11-2
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ module.config.public = {
4141
-- - [`"nvim-cmp"`](@core.integrations.nvim-cmp)
4242
-- - [`"coq_nvim"`](@core.integrations.coq_nvim)
4343
-- - [`"nvim-compe"`](@core.integrations.nvim-compe)
44+
-- - `{ module_name = "external.lsp-completion" }` this must be used with
45+
-- [neorg-interim-ls](https://github.com/benlubas/neorg-interim-ls) and can provide
46+
-- completions through a shim Language Server. This allows users without an auto complete
47+
-- plugin to still get neorg completions
4448
engine = nil,
4549

4650
-- The identifier for the Neorg source.
@@ -279,8 +283,13 @@ module.load = function()
279283
return
280284
end
281285

282-
-- If our engine is compe then attempt to load the integration module for nvim-compe
283-
if module.config.public.engine == "nvim-compe" and modules.load_module("core.integrations.nvim-compe") then
286+
-- check if a custom completion module is provided
287+
if type(module.config.public.engine) == "table" and module.config.public.engine["module_name"] then
288+
local completion_module = module.config.public.engine["module_name"]
289+
modules.load_module_as_dependency(completion_module, module.name, {})
290+
module.private.engine = modules.get_module(completion_module)
291+
elseif module.config.public.engine == "nvim-compe" and modules.load_module("core.integrations.nvim-compe") then
292+
-- If our engine is compe then attempt to load the integration module for nvim-compe
284293
modules.load_module_as_dependency("core.integrations.nvim-compe", module.name, {})
285294
module.private.engine = modules.get_module("core.integrations.nvim-compe")
286295
elseif module.config.public.engine == "nvim-cmp" and modules.load_module("core.integrations.nvim-cmp") then

0 commit comments

Comments
 (0)