From d5e56574f896120b78cdf56dc1132e76057f8877 Mon Sep 17 00:00:00 2001 From: Micah Halter Date: Sat, 6 Jul 2024 19:20:44 -0400 Subject: [PATCH] fix: correctly check if `mini.icons` is actually setup (#441) This leaves the `pcall` just so (1) we load the plugin if it is lazy loaded by the user and (2) we get LSP completion/validation with that type as well. --- lua/oil/util.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lua/oil/util.lua b/lua/oil/util.lua index c84c1e9..aa717ad 100644 --- a/lua/oil/util.lua +++ b/lua/oil/util.lua @@ -864,8 +864,9 @@ end ---@return (oil.IconProvider)? M.get_icon_provider = function() -- prefer mini.icons - local has_mini_icons, mini_icons = pcall(require, "mini.icons") - if has_mini_icons then + local _, mini_icons = pcall(require, "mini.icons") + ---@diagnostic disable-next-line: undefined-field + if _G.MiniIcons then -- `_G.MiniIcons` is a better check to see if the module is setup return function(type, name) return mini_icons.get(type == "directory" and "directory" or "file", name) end