tom-anders / telescope-vim-bookmarks.nvim

Integrates vim-bookmarks into telescope.nvim
MIT License
114 stars 23 forks source link

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

Open axrt opened 3 years ago

axrt commented 3 years ago

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!

tom-anders commented 3 years ago

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

gh-atuzhikov commented 2 years ago

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.