ray-x / go.nvim

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

Remove or Change the toggle gc annotation details #407

Closed KevenGoncalves closed 10 months ago

KevenGoncalves commented 10 months ago

Is there a way to change the text that appear in top of the files? I know is to run the codelens buts seems a random message so, I want to know if its possible to change it

ray-x commented 10 months ago

The easiest way is to disable codelens in the setup.

KevenGoncalves commented 10 months ago

And the hard way?

KevenGoncalves commented 10 months ago

Or there's a way to only active the codelens for gomod files and for go files not?

ray-x commented 10 months ago

You can do something like this after you disable it in go.nvim

  vim.api.nvim_create_autocmd({ 'BufRead', 'InsertLeave', 'BufWritePre' }, {
    group = vim.api.nvim_create_augroup('go_codelenses', {}),
    pattern = { '*.mod' },
    callback = function()
        vim.lsp.codelens.refresh()
    end,
  })
KevenGoncalves commented 10 months ago

Thanks man!

ray-x commented 10 months ago

I forget to metion, the gopls setting for codelenses is

        codelenses = {
          generate = true, -- show the `go generate` lens.
          gc_details = true, -- Show a code lens toggling the display of gc's choices.
          test = true,
          tidy = true,
          vendor = true,
          regenerate_cgo = true,
          upgrade_dependency = true,
        },

You can override some of the settings to false so you do not need to disable the whole feature.

KevenGoncalves commented 10 months ago

In the end I disabled only gc details