diff options
Diffstat (limited to 'lua/99/extensions/init.lua')
| -rw-r--r-- | lua/99/extensions/init.lua | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/lua/99/extensions/init.lua b/lua/99/extensions/init.lua new file mode 100644 index 0000000..a6e2bd6 --- /dev/null +++ b/lua/99/extensions/init.lua @@ -0,0 +1,47 @@ +local cmp = require("99.extensions.cmp") + +--- @class _99.Extensions.Source +--- @field init_for_buffer fun(_99: _99.State): nil +--- @field init fun(_99: _99.State): nil +--- @field refresh_state fun(_99: _99.State): nil + +--- @param completion _99.Completion | nil +--- @return _99.Extensions.Source | nil +local function get_source(completion) + if not completion or not completion.source then + return + end + local source = completion.source + if source == "cmp" then + return cmp + end +end + +return { + --- @param _99 _99.State + init = function(_99) + local source = get_source(_99.completion) + if not source then + return + end + source.init(_99) + end, + + --- @param _99 _99.State + setup_buffer = function(_99) + local source = get_source(_99.completion) + if not source then + return + end + source.init_for_buffer(_99) + end, + + --- @param _99 _99.State + refresh = function(_99) + local source = get_source(_99.completion) + if not source then + return + end + source.refresh_state(_99) + end, +} |
