Skip to content

findNvim: support finding nvim in Windows WSL #430

Closed

Description

@xiyaowong
No description provided.

Activity

  1. changed the title [-]Support finding nvim in the WSL[/-] [+]findNvim: support finding nvim in Windows WSL[/+] on Oct 19, 2024
  2. 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 changing paths: string[] to cmds: 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.

  3. gjf7 commented on Oct 21, 2024

    @gjf7

    Should we search wsl's $PATH?

  4. 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.

  5. gjf7 commented on Oct 21, 2024

    @gjf7

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

  6. 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, ...].

  7. justinmk commented on Oct 21, 2024

    @justinmk
    Member

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

  8. gjf7 commented on Oct 21, 2024

    @gjf7

    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

    Fields

    Effort

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions