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

chore: resolve undefined-field warnings, fix link git statuses, rewrite devicons #2968

Merged
merged 100 commits into from
Nov 3, 2024

Conversation

alex-courtis
Copy link
Member

@alex-courtis alex-courtis commented Oct 25, 2024

Resolves most undefined-field warnings however not enabled.

todo, subsequent PR:

  • nodes in iterators - adding a directory iterator would be best
  • decisions on link_to vs absolute path
  • any opts - more will come when enabling no-unknown

Dogfooding ~1 week

Includes fixes from #2983

…s, *_git_status (#2944)

* extract DirectoryLinkNode and FileLinkNode, move Node methods to children

* temporarily move DirectoryNode methods into BaseNode for easier reviewing

* move mostly unchanged DirectoryNode methods back to BaseNode

* tidy

* git.git_status_file takes an array

* update git status of links

* luacheck hack
…e:expand_or_collapse (#2957)

move expand_or_collapse to DirectoryNode
)

* move last_group_node to DirectoryNode

* move add BaseNode:as and more doc

* revert parameter name changes

* revert parameter name changes

* add Class

* move group methods into DN

* tidy group methods

* tidy group methods

* tidy group methods

* tidy group methods

* parent is DirectoryNode

* tidy expand all

* BaseNode -> Node

* move watcher to DirectoryNode

* last_group_node is DirectoryNode only

* simplify create-file

* simplify parent

* simplify collapse-all

* simplify live-filter

* style
@alex-courtis alex-courtis marked this pull request as draft October 25, 2024 08:49
@alex-courtis alex-courtis changed the base branch from master to 2941-move-lib-to-explorer October 25, 2024 22:30
@alex-courtis
Copy link
Member Author

alex-courtis commented Nov 2, 2024

Icon testing master vs branch:

  -- main components
  local icon, name = node:highlighted_icon(), node:highlighted_name()
  log.raw("dev", "%s icon=%s name=%s\n", node.name, vim.inspect(icon, { newline = "" }), vim.inspect(name, { newline = "" }))
vim.keymap.set("n", "<space>t", function()
  local explorer = core.get_explorer()

  log.raw("dev", "\nexplorer.opts.renderer.icons.show.folder = false\n")
  explorer.opts.renderer.icons.show.folder = false
  api.tree.reload()

  log.raw("dev", "\nexplorer.opts.renderer.icons.show.folder = true\n")
  explorer.opts.renderer.icons.show.folder = true
  api.tree.reload()

  log.raw("dev", "\nexplorer.opts.renderer.icons.web_devicons.folder.enable = true\n")
  explorer.opts.renderer.icons.web_devicons.folder.enable = true
  api.tree.reload()

  log.raw("dev", "\nexplorer.opts.renderer.icons.web_devicons.folder.color = false\n")
  explorer.opts.renderer.icons.web_devicons.folder.color = false
  api.tree.reload()

  log.raw("dev", "\nexplorer.opts.renderer.icons.web_devicons.file.color = false\n")
  explorer.opts.renderer.icons.web_devicons.file.color = false
  api.tree.reload()

  log.raw("dev", "\nexplorer.opts.renderer.icons.web_devicons.file.enable = false\n")
  explorer.opts.renderer.icons.web_devicons.file.enable = false
  api.tree.reload()

  log.raw("dev", "\ndevicons.default_icon = nil\n")
  devicons.default_icon = nil
  api.tree.reload()

  log.raw("dev", "\nicons.devicons = nil\n")
  icons.devicons = nil
  pcall(icons, reset_config)
  api.tree.reload()

  log.raw("dev", "\nexplorer.opts.renderer.icons.show.file = false\n")
  explorer.opts.renderer.icons.show.file = false
  api.tree.reload()

  log.raw("dev", "\napi.tree.expand_all()\n")
  api.tree.expand_all()

  log.raw("dev", "\nexplorer.opts.renderer.icons.show.folder = false\n")
  explorer.opts.renderer.icons.show.folder = false
  api.tree.reload()

end, { noremap = true })

Fixed typo on master:

local function get_folder_icon_default(node, has_children)
  local is_symlink = node.links_to ~= nil

Branch now does not show file link icon when renderer.icons.show.file, matching symlink folder behaviour.

Master used DevIconDefault when renderer.icons.web_devicons.file.color = false, corrected to use NvimTreeFileIcon

@alex-courtis alex-courtis marked this pull request as ready for review November 2, 2024 06:26
@alex-courtis alex-courtis changed the title chore: resolve undefined-field warnings chore: resolve undefined-field warnings, fix git link status, rewrite devicons Nov 3, 2024
@alex-courtis alex-courtis changed the title chore: resolve undefined-field warnings, fix git link status, rewrite devicons chore: resolve undefined-field warnings, fix link git statuses, rewrite devicons Nov 3, 2024
@alex-courtis alex-courtis merged commit 610a1c1 into master Nov 3, 2024
7 checks passed
@alex-courtis alex-courtis deleted the chore-undefined-field branch November 3, 2024 03:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant