telescope-vim-bookmarks.nvim icon indicating copy to clipboard operation
telescope-vim-bookmarks.nvim copied to clipboard

Add a guard to make sure no output is printed in "--headless" mode;

Open axrt opened this issue 3 years ago • 2 comments

Hi! First of all, thank you for the plugin, it is very very helpful. I would greatly appreciate if you choose to accept this tiny contribution. Please consider the description below:

Description of the problem at hand

Whenever I start neovim in headless mode (using the --headless flag), this plugin is loaded, and, due to the fact that not all of my repos have any bookmarks what so ever, sometimes I get the "No bookmakrs!" output from lua/telescope/_extensions/vim_bookmarks.lua:102 in the base; This may or may not mess up my downstream scripts if those happen to make use of the output printed by neovim;

Proposed mitigation

As suggested by lines 101-104 in lua/telescope/_extensions/vim_bookmarks.lua from the cl, check if neovim is being launched in headless mode, if not - allow the warning print, block if otherwise; the check is done through nvim_list_uis, which returns empty (nil-table) in case of headless mode;

Thank you for reviewing!

axrt avatar Oct 03 '21 21:10 axrt

Just curious, aren't there a lot of other plugins with print statements? How do you handle those?

tom-anders avatar Oct 04 '21 22:10 tom-anders

Very good question indeed.. I think the difference here might be stemming from that most plugins do print out, it's not happening during the initialization though.

gh-atuzhikov avatar Oct 07 '21 03:10 gh-atuzhikov