Skip to content
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

Rust debug message make nvim think something went wrong #21

Open
mraspaud opened this issue Jan 10, 2025 · 1 comment
Open

Rust debug message make nvim think something went wrong #21

mraspaud opened this issue Jan 10, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@mraspaud
Copy link

I tried using a new build of himalaya with neovim and the rust log debug coming on stderr confuse neovim in that it believes something went wrong.

Eg when sending an email:

Save draft [OK]                                                                                                                                                                                                                                                                                                                                                                                                                               
Sending email…                                                                                                                                                                                                                                                                                                                                                                                                                                
^[[2m2025-01-10T15:13:56.747012Z^[[0m ^[[33m WARN^[[0m ^[[2mimap_client::client::tokio^[[0m^[[2m:^[[0m IMAP BINARY extension not supported, using fallback                                                                                                                                                                                                                                                                                    
Error detected while processing function <lambda>79[1]..<SNR>43_on_exit[6]..function <lambda>79[1]..<SNR>43_on_exit:                                                                                                                                                                                                                                                                                                                          
line    6:                                                                                                                                                                                                                                                                                                                                                                                                                                    
E605: Exception not caught: CLI error, see :messages for more information        

A solution is to make an intermediate shell script the quiets down debug messages:
himalaya_fix.sh

#!/bin/sh
RUST_LOG="warn" himalaya

and in nvim/init.lua:

	{
		"pimalaya/himalaya-vim",
		config = function()
			vim.g.himalaya_executable = "~/.local/bin/himalaya_fix.sh"
			vim.g.himalaya_folder_picker = "telescope"
		end,
	},

setting the environment variable inside the init.lua file did not work, neither did setting the variable at nvim call.

@soywod
Copy link
Member

soywod commented Jan 10, 2025

One idea coming to my mind is to use stdout for any user output or error, and stderr for logs. This way we can easily play with the exit code (which is actually discarded by the Vim plugin — everything captured on stderr is an error):

  • If exit code 0, then stdout contains output
  • If exit code not 0, then stdout contains an error
  • Any data on stderr is a log, and can easily be put in a dedicated buffer.

@soywod soywod added the bug Something isn't working label Jan 10, 2025
@soywod soywod added this to Pimalaya Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: No status
Development

No branches or pull requests

2 participants