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

fix: Improve nvim detection #1946

Merged

Conversation

fredizzimo
Copy link
Member

@fredizzimo fredizzimo commented Jul 26, 2023

What kind of change does this PR introduce?

  • Fix

Don't rely on the shell specific exists, instead run nvim -v. Additionally, if there's unexpected output, for example if your shell is configured wrongly to output something when run in non-interactive mode, it will tell you so, instead of failing with very strange errors later.

The neovim-bin argument has also been changed to always require the binary to exist, instead if falling back to nvim as that's probably not what the user wants. If neovim-bin contains path separators the binary will be tried directly, otherwise which will be used to find the correct executable.

The which command has also been changed to always use the which crate first to avoid shell specific issues (for example nushell).

The output is printed directly to stderr instead of the log, for a more user friendly experience. Furthermore, the maybe disown call has been moved so that the user actually has a chance to see the errors in the console.

Did this PR introduce a breaking change?

A breaking change includes anything that breaks backwards compatibility either at compile or run time.

  • When specifying neovim-bin it does not fallback to nvim automatically
  • Binaries that does not output standard Neovim version info are no longer supported

Fixes #1812
Fixes #1345
Fixes #1229
Fixes #1296
Fixes #1570
Fixes #1945
I think there are more issues, but I can't find any right now.

@fredizzimo fredizzimo marked this pull request as draft July 26, 2023 11:12
@fredizzimo fredizzimo force-pushed the fsundvik/fix-nvim-detection branch 2 times, most recently from 38f29dd to 0c0e98a Compare July 26, 2023 11:27
Don't rely on the shell specific `exists", instead run `nvim -v`.
Additionally, if there's unexpected output, for example if your shell is
configured wrongly to output something when run in non-interactive mode,
it will tell you so, instead of failing with very strange errors later.

The `neovim-bin` argument has also been changed to always require the
binary to exist, instead if falling back to `nvim` as that's probably
not what the user wants. If `nevoim-bin` contains path separators the
binary will be tried directly, otherwise `which` will be used to find
the correct executable.

The which command has also been changed to always use the which crate
first to avoid shell specific issues (for example nushell).

The output is printed directly to stderr instead of the log, for a more
user friendly experience. Furthermore, the maybe disown call has been
moved so that the user actually has a chance to see the errors in the
console.
@fredizzimo
Copy link
Member Author

This needs testing that it still works though the macOS finder.

Copy link

@shekohex shekohex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@rpanachi
Copy link

rpanachi commented Aug 4, 2023

LGTM

src/bridge/command.rs Outdated Show resolved Hide resolved
src/bridge/command.rs Outdated Show resolved Hide resolved
src/bridge/command.rs Outdated Show resolved Hide resolved
src/bridge/command.rs Outdated Show resolved Hide resolved
src/main.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@MultisampledNight MultisampledNight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you! Choooooooo chooooooooo! 🚂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants