diff --git a/lua/codemp/init.lua b/lua/codemp/init.lua index 0852bd7..bb2bba2 100644 --- a/lua/codemp/init.lua +++ b/lua/codemp/init.lua @@ -28,14 +28,6 @@ if CODEMP == nil then password = "", }, setup = function (opts) - if CODEMP.native == nil then - CODEMP.native = require('codemp.loader').load() -- make sure we can load the native library correctly, otherwise no point going forward - if CODEMP.native == nil then - print(" !! could not load native bindings, try reloading") - return CODEMP - end - end - CODEMP.config = vim.tbl_extend('force', CODEMP.config, opts) -- register logger CODEMP.native.setup_tracing(CODEMP.config.debug_file or print, CODEMP.config.debug) @@ -78,4 +70,12 @@ if CODEMP == nil then } end +if CODEMP.native == nil then + CODEMP.native = require('codemp.loader').load() -- make sure we can load the native library correctly, otherwise no point going forward + if CODEMP.native == nil then + print(" !! could not load native bindings, try reloading") + return CODEMP + end +end + return CODEMP diff --git a/lua/codemp/loader.lua b/lua/codemp/loader.lua index 75de3cf..c6041c1 100644 --- a/lua/codemp/loader.lua +++ b/lua/codemp/loader.lua @@ -4,6 +4,7 @@ local function load() local ok, native = pcall(require, "codemp.native") if ok then return native end + print(native) return nil end