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

Neovide Opening File Opens Same File Twice #2609

Open
s4Dt0y opened this issue May 30, 2024 · 12 comments
Open

Neovide Opening File Opens Same File Twice #2609

s4Dt0y opened this issue May 30, 2024 · 12 comments
Labels
bug Something isn't working macos Specific to macOS and not investigable on other platforms

Comments

@s4Dt0y
Copy link

s4Dt0y commented May 30, 2024

When I open a file like "neovide main.rs", the file opens, but it opens the file twice in two different tabs. How do I open the file only once. Am I missing something here?

@s4Dt0y s4Dt0y added the bug Something isn't working label May 30, 2024
@s4Dt0y
Copy link
Author

s4Dt0y commented May 30, 2024

As a side note, one workaround is to use the add the --no-tabs flag.

@fredizzimo
Copy link
Member

I can't repeat this here, which platform are you running on?

@carlmueller
Copy link

It’s happening to me on MacOS Sonoma.

@s4Dt0y
Copy link
Author

s4Dt0y commented Jun 2, 2024

I can't repeat this here, which platform are you running on?

I'm on mac sonoma as well...the context for this is trying to set up neovim with unity. I started with trying nvr, but gave up after a couple of days. So I instead tried Neovide which def works better out of the box, but opens up the files twice.

@fredizzimo fredizzimo added the macos Specific to macOS and not investigable on other platforms label Jun 2, 2024
@carlmueller
Copy link

The following workaround works for me.

open -a neovide filename

@fredizzimo
Copy link
Member

fredizzimo commented Jun 4, 2024

Can someone provide a log file, neovide --log main.rs. I don't have a mac so I can't debug it myself, but maybe I'm able to spot something in the logs.

@carlmueller
Copy link

Odd. With neovide --log test.txt the file is not opened twice, but with neovide test.txt it is opened twice. I'm attaching the log file anyway.
neovide_rCURRENT.log

@fredizzimo
Copy link
Member

Very strange, maybe the commandline parser interprets the file as both a file to open and neovim arguments. Can you try with neovide main.rs --, forcing the neovim arguments to be empty?

Although, it should be the same on all platforms.

@carlmueller
Copy link

neovide test.txt -- still opens the file twice.

@carlmueller
Copy link

neovide test.txt --log does open the file twice (while neovide --log test.txt does not). I'm attaching the log file.
neovide_rCURRENT.log

@fredizzimo
Copy link
Member

Thanks, so it starts Neovim correctly. "/opt/homebrew/bin/nvim" "--embed" "-p" "test.txt", but additionally there's a TRACE [neovide::channel_utils] UIComand Parallel(FileDrop("test.txt")) event.

So, it seems like macOS is parsing the comandline and invoking the application:openFiles: https://developer.apple.com/documentation/appkit/nsapplicationdelegate/1428742-application handler despite running Neovide directly rather than throuh open and Neovide.app. I can't see anything in the documentation, neither did I find anything doing a quick internet search. So, I don't know how that parsing is done.

@fredizzimo
Copy link
Member

fredizzimo commented Jun 4, 2024

Here's the stupid design Apple has decided to implement
https://lists.apple.com/archives/cocoa-dev/2009/May/msg00480.html,

TLDR; there's no way to disable the built in parsing of the arguments, so we need to ignore the openfile requests for them, or maybe always only use openfile, and ignore the initial arguments.

The problem is that I can't find any official documentation of this, and nothing about what the scheme it uses, if everything that looks like a file is passed to openFile, or if the file actually has to exist for example. And in both cases we need to be able to filter the list of arguments.

I guess that's something for the one actually fixing the bug to find out...

We might also want to delay the initial file list parsing, see

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working macos Specific to macOS and not investigable on other platforms
Projects
None yet
Development

No branches or pull requests

3 participants