fix: first time load should not break installation

This commit is contained in:
əlemi 2024-09-14 23:57:47 +02:00
parent dc6c675615
commit 2abe23e493
Signed by: alemi
GPG key ID: A4895B84D311642C
2 changed files with 7 additions and 3 deletions

View file

@ -18,6 +18,9 @@ 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")
end
--CODEMP.native.logger(function (msg)
-- vim.schedule(function () print(msg) end)
--end, true)

View file

@ -1,9 +1,10 @@
---@module 'annotations'
---@return Codemp
---@return Codemp?
local function load()
local native, _ = require("codemp.native")
return native
local ok, native = pcall(require, "codemp.native")
if ok then return native end
return nil
end
return {