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

WSL 2 is not supported #82

Closed
victoragcosta opened this issue Jul 2, 2024 · 4 comments
Closed

WSL 2 is not supported #82

victoragcosta opened this issue Jul 2, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@victoragcosta
Copy link

victoragcosta commented Jul 2, 2024

Description

Cord.nvim cannot connect to the discord IPC from WSL 2. It basically times out. I've found a workaround in this Gist by searching through presence.nvim wiki on WSL, finding a link to a issue that linked to this Gist that worked for me. Considering the whole trip that I've had to do, I wanted to open this issue to register the bug and to register the workaround in a more accessible manner for users of this plugin.

These are the steps for the workaround:

  1. Install npiperelay inside windows (which I personally chose to build directly from WSL2)
  2. Install socat (I used brew to install it)
  3. Alias nvim to run socat executing npiperelay in a separate process before running actual nvim. You could do this by adding to .zshrc or .bashrc

Code written by @mousebyte in the Gist I found

nvim () {
    pidof socat > /dev/null 2>&1
    if ! $? -eq 0; then
        socat UNIX-LISTEN:/tmp/discord-ipc-0,fork \
          EXEC:"npiperelay.exe //./pipe/discord-ipc-0"&
    fi
    command nvim "$@"
}

Operating system

Ubuntu 22.04.4 LTS (WSL 2)

Neovim version

NVIM v0.10.0
Build type: Release
LuaJIT 2.1.1713484068

Steps to reproduce

  1. Open discord in windows
  2. Open WSL2 shell
  3. Run nvim
  4. :CordConnect
  5. Wait 15 seconds and see a message telling the connection attempts will stop and that discord has no info from neovim

Expected behavior

I expected that after starting cord.nvim plugin connection, I'd see my neovim info in discord and no timeout messages.

Actual behavior

The cord.nvim plugin never connects to discord and tells me that it's giving up after 15 seconds.

Minimal configuration

local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim'
if not (vim.uv or vim.loop).fs_stat(lazypath) then
  vim.fn.system({
    'git',
    'clone',
    '--filter=blob:none',
    'https://github.com/folke/lazy.nvim.git',
    '--branch=stable',
    lazypath,
  })
end
vim.opt.rtp:prepend(lazypath)

require('lazy').setup({
  {
    'vyfor/cord.nvim',
    build = './build',
    opts = {
        usercmds = true,
        log_level = nil,
        timer = {
          interval = 1500,
          reset_on_idle = false,
          reset_on_change = false,
        },
        editor = {
          image = nil,
          client = 'neovim',
          tooltip = 'The Superior Text Editor',
        },
        display = {
          show_time = true,
          show_repository = true,
          show_cursor_position = false,
          swap_fields = false,
          swap_icons = false,
          workspace_blacklist = {},
        },
        lsp = {
          show_problem_count = false,
          severity = 1,
          scope = 'workspace',
        },
        idle = {
          enable = true,
          show_status = true,
          timeout = 1800000,
          disable_on_focus = true,
          text = 'Idle',
          tooltip = '💤',
        },
        text = {
          viewing = 'Viewing {}',
          editing = 'Editing {}',
          file_browser = 'Browsing files in {}',
          plugin_manager = 'Managing plugins in {}',
          lsp_manager = 'Configuring LSP in {}',
          vcs = 'Committing changes in {}',
          workspace = 'In {}',
        },
        buttons = {
          {
            label = 'View Repository',
            url = 'git',
          },
        },
        assets = {},
    },
  },
}, {})
@victoragcosta victoragcosta added the bug Something isn't working label Jul 2, 2024
@vyfor
Copy link
Owner

vyfor commented Jul 2, 2024

Hey there! I wouldn't exactly call this a bug, since it's the user's responsibility to expose the named pipe to WSL. There isn't much Cord can do about it. As for the gist, I've successfully tested it on WSL 1 before, but I'm uncertain about WSL 2. However, if it does work as you said, it might be worth to create a wiki page for this to avoid the trouble you experienced. I'll get back to this once I'm home. Thanks!

@victoragcosta
Copy link
Author

Yeah, I don't think this is really a Cord problem, it's a microsoft one. But there's no accessible info about this common issue for WSL users, so having this info in the wiki is one of the ways I would consider this issue solved. The other one would be working around WSL's issues in Cord's code, but this is unrealistic and in your place I would only do it if it was really really easy to do.

@vyfor
Copy link
Owner

vyfor commented Jul 4, 2024

I've included a link to the gist in Cord's wiki. I didn't get into specifics since the gist seems to cover it all.

@vyfor
Copy link
Owner

vyfor commented Jul 7, 2024

I'll close this issue for the time being. If you have any questions left, feel free to open a new one.

@vyfor vyfor closed this as completed Jul 7, 2024
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
None yet
Development

No branches or pull requests

2 participants