-
-
Notifications
You must be signed in to change notification settings - Fork 855
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
feat(git): notify when not in a git repo instead of error #2181
Conversation
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.
Thanks :)
Hmm this broke a use case i forgot about: #410 (comment) |
@Conni2461 , this is how to do it know: #2183 (comment) It seems reasonable and rather intuitive to me, what do you think ? Some users were recommanding updating the Wiki with this new receipe. |
@antoinemadec @Conni2461 This change complicates my use-case by quite a bit. I run the following function: M.find_files = function(use_buffer_cwd)
local builtin = require('telescope.builtin')
local utils = require('telescope.utils')
local opts = {
follow = true,
hidden = true,
show_untracked = true,
use_git_root = false,
}
if use_buffer_cwd then
opts.cwd = utils.buffer_dir()
end
local ok = pcall(builtin.git_files, opts)
if not ok then
builtin.find_files(opts)
end
end This allows me to run I think this should be reverted. There's a lot of power in it erroring when failing. If you want to be notified instead you can always wrap the call yourself. |
I agree, i dont consider calling I was thinking about returning a bool if we started the picker, but this would still result in the vim.notify error message, which isn't ideal either. In fact you can no longer suppress the vim.notify error message easily (at all, without suppressing all notify messages with level error, or providing a no op for vim.notify). This isn't great either. So i was thinking about reverting because other people could always just do local wrap = function(builtin, opts)
local ok, msg = pcall(builtin, opts)
if not ok then
vim.notify(msg)
end
end
wrap(require("telescope.builtin").git_files, {}) something like this would achieves the same as the pr (not tested, written in github right now) So yeah, i'll need to think about it for a day or so. If you need that feature rn, please checkout a early commit or checkout branch 0.1.x |
The "not doing the same check twice" argument is sound. On my end, I like to be able to chose from find_files and git_files myself (when you are looking for untracked or ignored files in your repo for instance), and I'd rather have a default behavior that notifies me rather than errors out. I think it just boils down to:
Could also be a config option ? |
@Conni2461 👋🏼 Have you possibly landed in a decision here? I've been pushing off the required changes in my config but this issue is getting more frustrating. |
Yeah. I know i put the decision of because its a very opinionated issue. We could do a config option and i probably will do it on a more global level. Like what i am currently thinking is doing I will revert this commit now and then work on that issue this weekend. I hope this works for everyone :) |
)" This reverts commit a09df82.
#2225 does implement config value / option
feedback is appreciated. Edit: Its not done yet, because i have to go over all builtins and make error handling consistent. |
Description
Fixes #2180
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Configuration:
Checklist: