lite-xl / lite-xl-lsp

LSP Plugin for Lite XL editor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error on gopls start

yznts opened this issue · comments

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

Updated config with absolute gopls path, now getting this:

image

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.

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

image

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.

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

pylsp and pyright meets the same error