-
Notifications
You must be signed in to change notification settings - Fork 10
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
Handle Error when no tab is found (E5108
)
#24
Comments
telescope-tabs
When No Tab is Found (E5108
)E5108
)
E5108
)E5108
)
Thanks a lot for filing the issue! Your implementation looks good to me. If you want to submit a pull request, I'm happy to merge your changes. Or I can implement it myself if you prefer not to file a PR. Either way is fine for me :) |
I took a look at the code, and a simple fix could be applied as follows: Line 134, main.lua: if selection then
vim.api.nvim_set_current_tabpage(selection.value[5])
end While this prevents the error from occurring, it basically just does nothing when the selection is invalid. A better approach, in my opinion, would be to display an error message like |
Alright, I implemented a fix in #25. The only thing that I changed compared to your solution is that the picker does not get closed (that's what most telescope pickers do). If that's fine for you, I would merge it. |
Your fix doesn't seem to work on my machine (?) (could also be an issue on my side...) A fix that works better for me is this approach: local selection = action_state.get_selected_entry()
if selection then
actions.close(prompt_bufnr)
vim.api.nvim_set_current_tabpage(selection.value[5])
else
vim.notify('No matching tab found', vim.log.levels.WARN)
end I still have the issue that the |
That's strange, 'cause the control flow of our solutions is exactly the same. Do you get an error with mine, or what happens? I quickly swapped in your code snippet and I could trigger the else branch. |
https://github.com/domi413/telescope-tabs I made a fork of your repository. Maybe you can include my fork and try if it works on your machine |
Yes, your fork works perfectly fine on my machine. If I hit enter after searching for a nonexistent tab, |
This took quite a while... So I'm always using |
I encountered the following error when using the
telescope-tabs
extension fortelescope.nvim
:This error occurs when I search for a tab that doesn't exist (e.g., typing a string like
dddd
and pressingEnter
).Is there an option to catch the error, so it only prints a warning like "tab is not available"
I tried to implement the following approach but it don't know how i can catch the error. Any tips?
The text was updated successfully, but these errors were encountered: