Skip to content

Commit

Permalink
feat(completion): allow custom completion engines
Browse files Browse the repository at this point in the history
  • Loading branch information
benlubas authored and vhyrro committed Jul 8, 2024
1 parent bb8e102 commit 04d201d
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions lua/neorg/modules/core/completion/module.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ module.config.public = {
-- - [`"nvim-cmp"`](@core.integrations.nvim-cmp)
-- - [`"coq_nvim"`](@core.integrations.coq_nvim)
-- - [`"nvim-compe"`](@core.integrations.nvim-compe)
-- - `{ module_name = "external.lsp-completion" }` this must be used with
-- [neorg-interim-ls](https://github.com/benlubas/neorg-interim-ls) and can provide
-- completions through a shim Language Server. This allows users without an auto complete
-- plugin to still get neorg completions
engine = nil,

-- The identifier for the Neorg source.
Expand Down Expand Up @@ -279,8 +283,13 @@ module.load = function()
return
end

-- If our engine is compe then attempt to load the integration module for nvim-compe
if module.config.public.engine == "nvim-compe" and modules.load_module("core.integrations.nvim-compe") then
-- check if a custom completion module is provided
if type(module.config.public.engine) == "table" and module.config.public.engine["module_name"] then
local completion_module = module.config.public.engine["module_name"]
modules.load_module_as_dependency(completion_module, module.name, {})
module.private.engine = modules.get_module(completion_module)
elseif module.config.public.engine == "nvim-compe" and modules.load_module("core.integrations.nvim-compe") then
-- If our engine is compe then attempt to load the integration module for nvim-compe
modules.load_module_as_dependency("core.integrations.nvim-compe", module.name, {})
module.private.engine = modules.get_module("core.integrations.nvim-compe")
elseif module.config.public.engine == "nvim-cmp" and modules.load_module("core.integrations.nvim-cmp") then
Expand Down

0 comments on commit 04d201d

Please sign in to comment.