Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve git icons on directories #1809

Merged
merged 16 commits into from
Dec 17, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lua/nvim-tree/explorer/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ end

function Explorer:_load(node)
local cwd = node.link_to or node.absolute_path
local git_statuses = git.load_project_status(cwd)
M.explore(node, git_statuses)
local git_status = git.load_project_status(cwd)
M.explore(node, git_status)
end

function Explorer:expand(node)
Expand Down
10 changes: 5 additions & 5 deletions lua/nvim-tree/renderer/components/git.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,19 @@ local function warn_status(git_status)
end

local function get_icons_(node)
local git_statuses = explorer_common.get_git_status(node)
if git_statuses == nil then
local git_status = explorer_common.get_git_status(node)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was actually thinking we could use git_statuses everwhere as it is a much better variable name, similar to iconss.

However... looking through the whole codebase we are using git_status everywhere so I guess that change is outside of the scope of this PR.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahhh sorry, I misunderstood. Perhaps I'll open a PR right after this one specifically for git_statuses?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're keen I would be most grateful! There are a lot of usages...

if git_status == nil then
return nil
end

local inserted = {}
local iconss = {}

for _, git_status in pairs(git_statuses) do
local icons = M.git_icons[git_status]
for _, s in pairs(git_status) do
local icons = M.git_icons[s]
if not icons then
if not M.config.highlight_git then
warn_status(git_status)
warn_status(s)
end
return nil
end
Expand Down