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

Error on gopls start #43

Open
yznts opened this issue Dec 28, 2022 · 7 comments
Open

Error on gopls start #43

yznts opened this issue Dec 28, 2022 · 7 comments

Comments

@yznts
Copy link

yznts commented Dec 28, 2022

LSP config:

local lspconfig = require "plugins.lsp.config"

...

lspconfig.gopls.setup {
  command = {
    "gopls"
  },
  settings = {
    Lua = {
      diagnostics = {
        enable = false
      }
    }
  },
  verbose = true
}

Screenshot 2022-12-28 at 11 31 06

@yznts
Copy link
Author

yznts commented Dec 29, 2022

Updated config with absolute gopls path, now getting this:

image

@jgmdev
Copy link
Member

jgmdev commented Jan 1, 2023

I think the issue is you are adding settings that are specifically for the lua language server:

lspconfig.gopls.setup {
  command = {
    "gopls"
  },
  -- settings = { -- these settings are for the lua language server not gopls
  --  Lua = {
  --    diagnostics = {
  --      enable = false
  --    }
  --  }
  -- },
  verbose = true
}

A simple setup call lspconfig.gopls.setup() should be enough to enable the go language server.

@yznts
Copy link
Author

yznts commented Jan 2, 2023

With a generic lspconfig.gopls.setup() I have this issue, that's why I've ended up with explicit args.

image

@jgmdev
Copy link
Member

jgmdev commented Jan 2, 2023

Could be that your gopls is not the direct binary but a bash/shell script that points to it which makes the lsp not properly detect the real process id of running lsp server. Try from terminal with which gopls to see the path of invoked gopls binary and then confirm it is the real gopls binary and not a shell script invoking it.

@yznts
Copy link
Author

yznts commented Jan 4, 2023

Right, it was a soft linked into /usr/local/bin/gopls as far as binary located in ~/go/bin and can't be located by editor.

Also, tried this approach:

lspconfig.gopls.setup {
  command = {
    "/Users/yuriizinets/go/bin/gopls"
  }
}

Getting this error

image

@lin-calvin
Copy link

pylsp and pyright meets the same error

@Guldoman
Copy link
Member

Is this still an issue?

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

No branches or pull requests

4 participants