Skip to content

Conversation

@0xKahi
Copy link

@0xKahi 0xKahi commented Nov 17, 2025

compressed.mov
  • aded directory bookmarks
  • clean up deprecated nvim api
  • add highlights to file bookmarks split horizontal/vertical commands

Copilot AI review requested due to automatic review settings November 17, 2025 16:04
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request adds directory bookmark functionality to arrow.nvim, allowing users to bookmark and navigate to directories in addition to files. The PR also modernizes the codebase by replacing deprecated Neovim API calls with their current equivalents and adds visual highlighting for split mode operations.

Key changes:

  • Introduces a parallel directory bookmark system with dedicated persistence functions and UI support
  • Migrates from deprecated nvim_buf_add_highlight and nvim_buf_set_option APIs to nvim_buf_set_extmark and nvim_set_option_value
  • Adds new highlight group ArrowSplitMode for visual feedback during horizontal/vertical split operations

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
lua/arrow/ui.lua Refactors UI rendering to support dual bookmark types, migrates to extmark-based highlighting, adds bookmark type toggle functionality
lua/arrow/persist.lua Implements directory bookmark persistence with save/load/toggle/clear operations, adds fallback for missing save_key_cached
lua/arrow/integration/icons.lua Adds directory icon support and refactors provider selection logic based on explicit configuration
lua/arrow/init.lua Adds new highlight groups, directory bookmark configuration, and default directory path list
lua/arrow/buffer_ui.lua Updates deprecated API calls to modern equivalents, creates dedicated namespace for buffer highlights
README.md Documents new directory bookmark feature, icon provider configuration, and toggle_bookmark_type mapping
Comments suppressed due to low confidence (1)

README.md:9

  • Corrected spelling: Remove extraneous 'L' from 'bookmarksL:' to 'bookmarks:'.
### Per Project / Global bookmarksL:

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

quit = "q",
remove = "x", -- only used if separate_save_and_remove is true
next_item = "]",
prev_item = "["
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

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

Missing comma after prev_item = "[" on the previous line. This will cause a syntax error in the Lua table definition.

Suggested change
prev_item = "["
prev_item = "[",

Copilot uses AI. Check for mistakes.
},
opts = {
show_icons = true,
icon_provider = 'nvim-web-devicons', -- or 'mini.icons'
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

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

The icon_provider value 'nvim-web-devicons' does not match the implementation in lua/arrow/integration/icons.lua which expects 'web_dev_icons' (line 31). This mismatch will cause the icon provider selection to fail. Change to 'web_dev_icons' to match the implementation.

Suggested change
icon_provider = 'nvim-web-devicons', -- or 'mini.icons'
icon_provider = 'web_dev_icons', -- or 'mini.icons'

Copilot uses AI. Check for mistakes.
end

return get_icon_from_mini(file_name)
end
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

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

The function does not return a value when provider is neither 'web_dev_icons' nor 'mini'. This can lead to nil values being returned unexpectedly. Add an else clause at the end that either throws an error about invalid provider or provides a default fallback.

Suggested change
end
end
error("Invalid icon provider: " .. tostring(provider), vim.log.levels.ERROR)

Copilot uses AI. Check for mistakes.
local extension = vim.fn.fnamemodify(file_name, ":e")
local icon, hl_group = webdevicons.get_icon(file_name, extension, { default = true })
if vim.fn.isdirectory(file_name) == 1 then
return "H", "Normal"
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

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

[nitpick] The hardcoded directory icon 'H' seems inconsistent with typical folder icons. Consider using a proper folder icon (e.g., '' or webdevicons' folder icon) or making it configurable. The choice of 'H' is unclear and may not visually represent a directory well.

Suggested change
return "H", "Normal"
local icon, hl_group = webdevicons.get_icon(file_name, "", { default = true })
return icon, hl_group

Copilot uses AI. Check for mistakes.
Comment on lines +432 to +434
if bookmark_type == "dir" then
local dir_config = config.getState("dir_bookmark_config")
action = dir_config and dir_config.open_action
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

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

If dir_config.open_action is nil, action will be nil, leading to a potential error when trying to call action(fileName, vim.b.filename) at line 459. Add validation to ensure open_action exists or provide a fallback error message.

Copilot uses AI. Check for mistakes.
{ key = mappings.edit, text = string.format("%s Edit Arrow File", mappings.edit) },
{ key = mappings.clear_all_items, text = string.format("%s Clear All Items", mappings.clear_all_items) },
{ key = mappings.delete_mode, text = string.format("%s Delete Mode", mappings.delete_mode) },
-- { key = mappings.toggle_bookmark_type, text = string.format("%s Switch Mode", mappings.toggle_bookmark_type) },
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

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

This commented-out code should either be removed or have a clear explanation why it's disabled. Leaving commented code without context makes maintenance harder.

Suggested change
-- { key = mappings.toggle_bookmark_type, text = string.format("%s Switch Mode", mappings.toggle_bookmark_type) },

Copilot uses AI. Check for mistakes.
displayIndex = config.getState("index_keys"):sub(i, i)

vim.api.nvim_buf_add_highlight(buf, -1, "ArrowDeleteMode", i + 3, 0, -1)
-- vim.api.nvim_buf_add_highlight(buf, -1, "ArrowDeleteMode", i + 3, 0, -1)
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

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

This commented-out deprecated API call should be removed since it has been replaced with the extmark API. Keeping old code comments clutters the codebase.

Suggested change
-- vim.api.nvim_buf_add_highlight(buf, -1, "ArrowDeleteMode", i + 3, 0, -1)

Copilot uses AI. Check for mistakes.
Copy link
Owner

@otavioschwanck otavioschwanck left a comment

Choose a reason for hiding this comment

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

.

Copy link
Owner

@otavioschwanck otavioschwanck left a comment

Choose a reason for hiding this comment

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

test (testing pr-reviewer.nvim)

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.

2 participants