Skip to content

findNvim: support finding nvim in Windows WSL #430

Open
@xiyaowong

Description

@xiyaowong
No description provided.

Activity

changed the title [-]Support finding nvim in the WSL[/-] [+]findNvim: support finding nvim in Windows WSL[/+] on Oct 19, 2024
justinmk

justinmk commented on Oct 19, 2024

@justinmk
Member

Ok, I see that this blocks vscode-neovim/vscode-neovim#2287 .

https://github.com/vscode-neovim/vscode-neovim/blob/c3e8387a9e9f923ec39c28af6cb8985ca431e438/src/main_controller.ts#L181-L186

if (config.useWsl) {
    args.push("C:\\Windows\\system32\\wsl.exe");
    if (config.wslDistribution.length) {
        args.push("-d", config.wslDistribution);
    }
}

I think that findNvim can support this without much complexity, by accepting changing paths: string[] to paths: string[][], so that consumers can pass a command like:

findNvim(..., {
 paths: [
   ['C:\\Windows\\system32\\wsl.exe', '-d', ..., 'nvim'],
 ],
})

Perhaps in the future, findNvim could be more clever and do this internally. But meanwhile this is a simple change.

gjf7

gjf7 commented on Oct 21, 2024

@gjf7
Contributor

Should we search wsl's $PATH?

justinmk

justinmk commented on Oct 21, 2024

@justinmk
Member

Should we search wsl's $PATH?

We could try that in the future, but I think just changing the current paths: string[] to a cmds: string[][] solve the main problem for now.

gjf7

gjf7 commented on Oct 21, 2024

@gjf7
Contributor

I'm not sure I follow. What should findNvim actually return in this case? The full WSL command, or just the nvim path?

justinmk

justinmk commented on Oct 21, 2024

@justinmk
Member

The missing piece is that consumers like vscode-neovim/vscode-neovim#2287 can't send a full command which represents "nvim". It can only send a location (arg0) or directory.

node-client doesn't need to know about WSL, it just needs to run what the consumer gives it. Currently the consumer can only send arg0, but we can fix that by allowing consumers to send [arg0, arg1, ...].

justinmk

justinmk commented on Oct 21, 2024

@justinmk
Member

I have a PR that I'll post in a minute. #432

gjf7

gjf7 commented on Oct 21, 2024

@gjf7
Contributor

Ah, I see.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @justinmk@xiyaowong@gjf7

      Issue actions

        findNvim: support finding nvim in Windows WSL · Issue #430 · neovim/node-client