Skip to content

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

Open
axrt wants to merge 1 commit into
tom-anders:mainfrom
axrt:main
Open

Add a guard to make sure no output is printed in "--headless" mode;#7
axrt wants to merge 1 commit into
tom-anders:mainfrom
axrt:main

Conversation

@axrt

@axrt axrt commented Oct 3, 2021

Copy link
Copy Markdown

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

Copy link
Copy Markdown
Owner

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

@gh-atuzhikov

Copy link
Copy Markdown

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants