Skip to content

Commit

Permalink
fix: don't try to pull lua-utils when it's not applicable
Browse files Browse the repository at this point in the history
  • Loading branch information
vhyrro committed Mar 24, 2024
1 parent eea6263 commit bcac799
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
11 changes: 8 additions & 3 deletions lua/neorg.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ function neorg.setup(cfg)
},
})

neorg.lib = assert(require("lua-utils"), "unable to find lua-utils dependency. Perhaps try restarting Neovim?")
local lua_utils = assert((pcall(require, "lua-utils")), "unable to find lua-utils dependency. Perhaps try restarting Neovim?")

neorg.lib = lua_utils
neorg.log = require("neorg.core.log")

-- If the file we have entered has a `.norg` extension:
if vim.fn.expand("%:e") == "norg" or not config.user_config.lazy_loading then
Expand Down Expand Up @@ -66,8 +69,10 @@ function neorg.setup_after_build()
end

-- HACK(vhyrro): Please do this elsewhere.
neorg.lib =
assert((pcall(require, "lua-utils")), "unable to find lua-utils dependency. Perhaps try restarting Neovim?")
local lua_utils = assert((pcall(require, "lua-utils")), "unable to find lua-utils dependency. Perhaps try restarting Neovim?")

neorg.lib = lua_utils
neorg.log = require("neorg.core.log")

neorg.setup(user_configuration)
end
Expand Down
1 change: 0 additions & 1 deletion lua/neorg/core/init.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
local neorg = {
callbacks = require("neorg.core.callbacks"),
config = require("neorg.core.config"),
log = require("neorg.core.log"),
modules = require("neorg.core.modules"),
utils = require("neorg.core.utils"),
}
Expand Down
4 changes: 2 additions & 2 deletions lua/neorg/core/log.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
-- This library is free software; you can redistribute it and/or modify it
-- under the terms of the MIT license. See LICENSE for details.

local lib = assert(require("lua-utils"), "unable to find lua-utils dependency. Perhaps try restarting Neovim?")
local lib = require("lua-utils")

--- @alias LogLevel
--- | "trace"
Expand All @@ -24,7 +24,7 @@ local lib = assert(require("lua-utils"), "unable to find lua-utils dependency. P
--- @field use_file boolean Whether to write output to a file.
--- @field level LogLevel Any messages above this level will be logged.
--- @field modes ({ name: LogLevel, hl: string, level: number })[] Level configuration.
--- @field float_precision float Can limit the number of decimals displayed for floats.
--- @field float_precision number Can limit the number of decimals displayed for floats.

--- User configuration section
--- @type neorg.log.configuration
Expand Down

0 comments on commit bcac799

Please sign in to comment.