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 LSP not starting when opening a golang file #380

Open Chaitanyabsprip opened 9 months ago

Chaitanyabsprip commented 9 months ago
Config ```lua { 'ray-x/go.nvim', dependencies = { 'neovim/nvim-lspconfig', 'nvim-treesitter/nvim-treesitter', }, keys = { { 'gfi', 'GoIfErr', noremap = true, desc = 'Go: Autofill If-err block' }, { 'gfs', 'GoFillStruct', noremap = true, desc = 'Go: Autofill Struct with fields' }, { 'gfw', 'GoFillSwitch', noremap = true, desc = 'Go: Autofill Switch with cases' }, { 'gfp', 'GoFixPlurals', noremap = true, desc = 'Go: Auto collate plural params with same type', }, }, opts = { gofmt = 'gofumpt', lsp_gofumpt = true, lsp_keymaps = false, lsp_inlay_hints = { enable = false }, lsp_cfg = true, }, event = 'CmdlineEnter', ft = { 'go', 'gomod' }, build = ':lua require("go.install").update_all_sync()', } ```

When I open a *.go file, I expect the LSP server to start automatically, however currently I'm needing to run LspStart.

ray-x commented 8 months ago

Is require('go').setup(opts) been called anywhere else?

Chaitanyabsprip commented 8 months ago

no, just here

ray-x commented 8 months ago

should config be set to true?

Chaitanyabsprip commented 8 months ago

as per a discussion in the lazy.nvim repo, that is not necessary if you're passing a table to opts, as I am.

I've noticed that if I do not lazy load on filetype then this issue does not occur. Could be something I'm missing in my understanding of lazy works or something is broken either in this plugin or lazy.nvim

SichangHe commented 4 months ago

314 again?

qwexvf commented 4 months ago

@SichangHe the config above should work fine.