ray-x / go.nvim

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

[bug?] GoTest results in Trouble v3 appear as arrays of line/char combinations #503

Open hjkatz opened 2 months ago

hjkatz commented 2 months ago

So.... I think this may be from this library, but I'm not 100% sure.

Basically Trouble recently went through a rewrite for v3, see: https://github.com/folke/trouble.nvim

And now I see this output from :GoTest in the qflist output:

image

The line and char are correct, but I would expect this to show the go test multiline output as before.

I'm not sure if this is something to fix/adopt in this plugin or to configure in Trouble, but I think you'll have a better idea of where/how to adjust this behaviour.

lmk, thanks!

Here's my config btw - very minimal

    require('go').setup({
        luasnip = true,
        lsp_cfg = false, -- use my own lspconfig
        trouble = true,
    })
ray-x commented 2 months ago

I am not aware of trouble changes, try the main version and it looks like this: diagnostic mode: image

qlist: image

It looks correct to me.

hjkatz commented 2 months ago

hmmmm, for some reason even the diagnostics are not appearing.

I'm running:

:GoTestFunc
:Trouble diagnostics open

But I just get a blank scratch buffer.

Perhaps this is at play: https://github.com/folke/trouble.nvim/issues/514

I'm trying to read through the code here https://github.com/ray-x/go.nvim/blob/master/lua/go/asyncmake.lua#L185 but I'm having trouble understanding where you set the diagnostics?

Playing with this more it appears that there are no diagnostics for the buffers open at all. I'm not even seeing go test diagnostics come back with Telescope.

But, I do see the [100, 1] lines in the qflist... so I'm not sure where the diagnostics are ending up.

FWIW I also use your ray-x/navigator.vim plugin too with this configuration:

 require("navigator").setup({
    debug = false,
    mason = true,
    default_mapping = false,
    lsp_signature_help = true,
    signature_help_cfg = nil, -- configure ray-x/lsp_signature_help on its own
    lines_show_prompt = 20, -- when result list is >= number, then show input prompt
    prompt_mode = 'normal', -- default mode for prompt
    lsp = {
        -- Disable all lsp setup including code actions, lens, diagnostics, etc...
        -- I will set these up via copy/paste functions from ray-x/navigator.lua
        -- into my lsp config below
        -- some config settings will still be loaded and respected during require("navigator.*").some_fn calls
        enable = false,
        disable_lsp = "all",
        code_action = {
          enable = true,
          sign = true,
          delay = 5000, -- ms
        },
        diagnostic_scrollbar_sign = false, -- disable scrollbar symbols
        diagnostic_virtual_text = '', -- empty floating text prefix
        display_diagnostic_qf = false, -- do not display qf on save
        tsserver = {
            single_file_support = true,
        }, [<hkatz@ngrok.com>, 2023-10-18 [1580c134] - update treesitter, navigator icons, and copilot behaviour]
        ts_ls = { -- renamed from tsserver
            single_file_support = true,
        },
        format_on_save = false,
    },
    icons = {
      icons = true, -- requires nerd fonts

      -- Code action
      code_action_icon = '󱐋 ',

      -- code lens
      code_lens_action_icon = '󰍉 ',

      -- Diagnostics -- appear in the sign column
      diagnostic_head = "", -- empty prefix
      diagnostic_err = "",
      diagnostic_warn = "",
      diagnostic_info = "",
      diagnostic_hint = "",

      -- these icons appear in the floating windows
      diagnostic_head_severity_1 = ' ',
      diagnostic_head_severity_2 = ' ',
      diagnostic_head_severity_3 = ' ',
      diagnostic_head_description = '', -- empty description (suffix for severities)
      diagnostic_virtual_text = '', -- empty floating text prefix
      diagnostic_file = '', -- icon in floating window indicating a file contains diagnostics
}

  -- load diagnostics (disabled by lsp.enabled = false)
  require('navigator.diagnostics').config({})

Perhaps I'm holding this config wrong?

ray-x commented 2 months ago

navigator will help set up gopls diagnostics. It does not affect GoTest results output. Golangci lint diagnostic of go.nvim is pump through null-ls/none-ls, gopls diagnostic is using standard neovim lsp.

I have a feeling that some setting in config prevent quickfix list display correctly.

You can add log statements before setqflist to display the lines and check if those are expected.