-
Notifications
You must be signed in to change notification settings - Fork 203
fix(snacks): forward cwd to snacks picker items #648
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
base: main
Are you sure you want to change the base?
fix(snacks): forward cwd to snacks picker items #648
Conversation
|
This PR is stale because it has been open 30 days with no activity. |
lua/trouble/sources/snacks.lua
Outdated
| source = "snacks", | ||
| buf = item.buf, | ||
| filename = item.file, | ||
| filename = item.cwd and vim.fs.joinpath(item.cwd, item.file) or item.file, |
There was a problem hiding this comment.
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.
lua/trouble/item.lua
Outdated
| local path = self.cwd and vim.fs.joinpath(self.cwd, self.filename) or self.filename | ||
| self.filename = vim.fs.normalize(path) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
Description
Fixes an issue where
trouble_opendidn’t respect thecwdin the Snacks Picker integration.Right now, if you use something like:
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)