ray-x / go.nvim

G'day Nvimer, Joyful Gopher: Discover the Feature-Rich Go Plugin for Neovim
MIT License
1.93k stars 119 forks source link

Gopls import local string #340

Open JLineaweaver opened 1 year ago

JLineaweaver commented 1 year ago

I'm attempting to change my import function so it breaks down in the following way.

<stdlib>

<third party>

<local>

However for my local dependencies I want to be able to define with a string. In vscode you can do the following

"formatting.local": "github.com/MyRepo,go.MyBuild.com"

Can we add a top level setting for this as well?

bbiao commented 11 months ago

Hi, @ray-x

I have tried to use the following options to setup go.nvim

      require("go").setup({
        lsp_cfg = {
          settings = { gopls = { ["local"] = "gitlab.mycompany.com" } },
        },
      })

And by running :lua print(vim.inspect(vim.lsp.get_active_clients())) shows the config is valid. But imports of "gitlab.mycompany.com" are not import separately.

The result is like:

import (
  "time"
  "sync"

  "github.com/google/uuid"
  "github.com/pkg/errors"
  "github.com/sirupsen/logrus"
  "gitlab.mycompany.com/group/repo-a"
  "gitlab.mycompany.com/group/repo-b"
)