Skip to content

Conversation

@barspielberg
Copy link

Description

Fixes an issue where trouble_open didn’t respect the cwd in the Snacks Picker integration.

Right now, if you use something like:

Snacks.picker.files({ cwd = other_cwd })

You’ll see the right results, but navigation breaks unless you're in the same root directory. This is especially annoying when working in a monorepo and searching inside a specific package.

Related Issue(s)

@github-actions
Copy link
Contributor

This PR is stale because it has been open 30 days with no activity.

@github-actions github-actions bot added the stale This issue or PR has been inactive for a while label Aug 21, 2025
source = "snacks",
buf = item.buf,
filename = item.file,
filename = item.cwd and vim.fs.joinpath(item.cwd, item.file) or item.file,
Copy link
Owner

Choose a reason for hiding this comment

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

instead of the join here, it should be enough to also assign cwd = item.cwd.

@folke folke changed the title fix(Snacks Picker integration): Respect cwd fix(snacks): forward cwd to snacks picker items Sep 15, 2025
Comment on lines 40 to 41
local path = self.cwd and vim.fs.joinpath(self.cwd, self.filename) or self.filename
self.filename = vim.fs.normalize(path)
Copy link
Owner

Choose a reason for hiding this comment

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

This should not be needed?

Copy link
Author

Choose a reason for hiding this comment

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

You are right, I handled the normalization wrong 🤦
I'll normalize the filename first, and also the cwd

@github-actions github-actions bot removed the stale This issue or PR has been inactive for a while label Sep 16, 2025
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.

bug: Snaks picker integration doesn't respect cwd parameter

2 participants