Skip to content

Commit

Permalink
fix(sources): path: should use file icons for symbols of type 'file'
Browse files Browse the repository at this point in the history
  • Loading branch information
bekaboo committed Jun 14, 2023
1 parent 9c482d3 commit 190dcc1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lua/dropbar/hlgroups.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ local hlgroups = {
DropBarIconKindEnumMember = { link = 'CmpItemKindEnumMember' },
DropBarIconKindEvent = { link = 'CmpItemKindEvent' },
DropBarIconKindField = { link = 'CmpItemKindField' },
DropBarIconKindFile = { link = 'NormalFloat' },
DropBarIconKindFile = { link = 'Directory' },
DropBarIconKindFolder = { link = 'Directory' },
DropBarIconKindForStatement = { link = 'Repeat' },
DropBarIconKindFunction = { link = 'Function' },
Expand Down
10 changes: 8 additions & 2 deletions lua/dropbar/sources/path.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@ local bar = require('dropbar.bar')
---@return string icon
---@return string? icon_hl
local function get_icon(path)
local icon = configs.opts.icons.kinds.symbols.Folder
local icon_hl = 'DropBarIconKindFolder'
local icon = configs.opts.icons.kinds.symbols.File
local icon_hl = 'DropBarIconKindFile'
local stat = vim.loop.fs_stat(path)
if not stat then
return icon, icon_hl
elseif stat.type == 'directory' then
icon = configs.opts.icons.kinds.symbols.Folder
icon_hl = 'DropBarIconKindFolder'
end
if configs.opts.icons.kinds.use_devicons then
local devicons_ok, devicons = pcall(require, 'nvim-web-devicons')
if devicons_ok and stat and stat.type ~= 'directory' then
Expand Down

0 comments on commit 190dcc1

Please sign in to comment.