doom-nvim icon indicating copy to clipboard operation
doom-nvim copied to clipboard

[FEATURE REQUEST] Refactor `require` to use `pcall` in language configurations

Open connorgmeehan opened this issue 3 years ago • 0 comments
trafficstars

What is the feature, what would you like to be able to do?

Sometimes dependencies aren't installed, this is especially an issue in language configurations where the execution is not tied to the plugin being installed / loaded (unlike a config function). I would like all require to be refactored to the following for safety.

local ok, dep = pcall(require, 'dep')
if not ok then
  return
end

What is the use case, why do you want this feature?

This would allow doom-nvim to start without errors if there is an issue loading a dependency.

Possible Implementation (if applicable)

Create a safe require function in utils.lua that tries to require a dep, logs and returns nil if it fails or returns the dep.

Additional context

connorgmeehan avatar Aug 01 '22 23:08 connorgmeehan