Skip to content

feat(oldfiles): customize shada file#2704

Merged
ibhagwan merged 1 commit intomainfrom
feat/oldfiles_custom_shada
Apr 25, 2026
Merged

feat(oldfiles): customize shada file#2704
ibhagwan merged 1 commit intomainfrom
feat/oldfiles_custom_shada

Conversation

@ibhagwan
Copy link
Copy Markdown
Owner

@ibhagwan ibhagwan commented Apr 25, 2026

Supply custom shada file to read using :rshada! (opts.shada), enables oldfiles from the cli.

Summary by CodeRabbit

  • New Features

    • Added an option to load a specific shada file to populate recent files; the file is validated and a warning is shown if missing.
  • Documentation

    • Public configuration now documents an optional shada_file setting for the recent-files feature.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 25, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0635e421-6927-4a7b-8a1b-73faab461343

📥 Commits

Reviewing files that changed from the base of the PR and between a041e79 and e1ba6c8.

📒 Files selected for processing (2)
  • lua/fzf-lua/defaults.lua
  • lua/fzf-lua/providers/oldfiles.lua

📝 Walkthrough

Walkthrough

Adds optional shada-file sourcing to the oldfiles provider: when configured, the provider normalizes and verifies the shada path, attempts to source it via :rshada!, then enumerates vim.v.oldfiles; if the file is missing it warns and proceeds without sourcing.

Changes

Cohort / File(s) Summary
Oldfiles + defaults
lua/fzf-lua/defaults.lua, lua/fzf-lua/providers/oldfiles.lua
Added shada_file? string to fzf-lua.config.Oldfiles type; implemented optional shada-file handling in the oldfiles provider: path normalization, existence check, :rshada! sourcing, warning on missing file, then enumerate vim.v.oldfiles.

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant P as Oldfiles Provider
    participant FS as Filesystem
    participant NV as Neovim

    U->>P: Request oldfiles (opts.shada_file?)
    alt shada_file set
        P->>FS: normalize & stat(shada_file)
        FS-->>P: exists / not exists
        alt exists
            P->>NV: execute :rshada! <escaped path>
            NV-->>P: vim.v.oldfiles updated
        else not exists
            P-->>U: warn "shada file not found"
        end
    end
    P->>NV: read vim.v.oldfiles
    NV-->>P: return oldfiles list
    P-->>U: present results
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 I found a trail of memory bright,

I nuzzled paths by soft moonlight,
If shada calls, I hop and read—
Old files wake at my quick speed,
A carrot cheer for histories bared.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(oldfiles): customize shada file' clearly and concisely summarizes the main change: adding customization for the shada file in the oldfiles provider.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/oldfiles_custom_shada

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@lua/fzf-lua/providers/oldfiles.lua`:
- Around line 74-82: The shada file path is passed unescaped and uses vim.uv
directly; change the block that handles opts.shada so it checks existence with
the local uv alias (uv.fs_stat) and calls vim.cmd("rshada! " ..
vim.fn.fnameescape(file)) instead of concatenating the raw path, ensuring you
compute file = vim.fs.normalize(opts.shada) first and keep the existing
utils.warn message when the file is missing.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 16fd87e3-0cb3-4208-bb77-5757099a5354

📥 Commits

Reviewing files that changed from the base of the PR and between ffa44ee and 985ac9e.

📒 Files selected for processing (2)
  • lua/fzf-lua/defaults.lua
  • lua/fzf-lua/providers/oldfiles.lua

Comment thread lua/fzf-lua/providers/oldfiles.lua
@ibhagwan ibhagwan force-pushed the feat/oldfiles_custom_shada branch from 985ac9e to a041e79 Compare April 25, 2026 18:14
Supply custom shada file to read using `:rshada!` with
`opts.shada_file`, enables oldfiles from the cli.
@ibhagwan ibhagwan force-pushed the feat/oldfiles_custom_shada branch from a041e79 to e1ba6c8 Compare April 25, 2026 18:31
@ibhagwan ibhagwan merged commit 17bad24 into main Apr 25, 2026
3 of 4 checks passed
@ibhagwan ibhagwan deleted the feat/oldfiles_custom_shada branch April 25, 2026 18:38
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