Skip to content

Commit

Permalink
fix: show warning when icons=true but devicons is not installed
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Apr 23, 2021
1 parent b20a784 commit 7aabea5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lua/trouble/renderer.lua
Expand Up @@ -10,7 +10,12 @@ local renderer = {}
local signs = {}

local function get_icon(file)
local icons, _ = require('nvim-web-devicons')
local ok, icons = pcall(require, 'nvim-web-devicons')
if not ok then
util.warn(
"'nvim-web-devicons' is not installed. Install it, or set icons=false in your configuration to disable this message")
return ""
end
local fname = vim.fn.fnamemodify(file, ":t")
local ext = vim.fn.fnamemodify(file, ":e")
return icons.get_icon(fname, ext, {default = true})
Expand Down

0 comments on commit 7aabea5

Please sign in to comment.