ray-x / go.nvim

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

Turn off automatic publish of diagnostics to quickfix list #375

Closed dapc11 closed 11 months ago

dapc11 commented 1 year ago

Hello,

As the title says, is there a way to turn off go.nvim to publish diagnostics of the current buffer to the quickfix list (qflist)? If I don't lazy load this plugin for only go-repositories it takes the workspace diagnostics and publish it to the qflist without my consent ;).

I would still like to have diagnostics visible, but not populated to the qflist without me doing so. As this interfere with my way of working, where I usually pick out a few locations with Telescope, send it to qflist and go ham on them. But every time the buffer updates/is saved it will overwrite whatever I had in the qflist. A workaround is to go to previous qflist (:cold).

{
    "ray-x/go.nvim",
    dependencies = {
      "ray-x/guihua.lua",
      "nvim-treesitter/nvim-treesitter",
      "mfussenegger/nvim-dap",
    },
    opts = {
      disable_defaults = false,
      go = "go",
      gofmt = "gofmt",
      max_line_len = 100,
      comment_placeholder = "",
      icons = { breakpoint = "", currentpos = "" },
      lsp_cfg = {
        capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities()),
        settings = {
          gopls = {
            gofumpt = false,
            codelenses = {
              gc_details = true,
              generate = true,
              regenerate_cgo = true,
              test = true,
              tidy = true,
              upgrade_dependency = true,
              vendor = true,
            },
            hints = {
              assignVariableTypes = true,
              compositeLiteralFields = true,
              constantValues = true,
              functionTypeParameters = true,
              parameterNames = true,
              rangeVariableTypes = true,
            },
            diagnosticsDelay = "300ms",
            symbolMatcher = "fuzzy",
            completeUnimported = true,
            staticcheck = false,
            matcher = "Fuzzy",
            usePlaceholders = true,
            analyses = {
              fieldalignment = true,
              nilness = true,
              shadow = true,
              unusedparams = true,
              unusedwrite = true,
            },
          },
        },
      },
      lsp_keymaps = false,
      sign_priority = 5,
      test_runner = "go", -- one of {`go`, `richgo`, `dlv`, `ginkgo`, `gotestsum`}
      luasnip = true,
      trouble = false,
    },
    build = ':lua require("go.install").update_all_sync()',
  }
ray-x commented 1 year ago

This is the setup you looking, set it to false { lsp_diag_hdlr = true, -- hook lsp diag handler }

If you using latest version, it will be diagnostic.hdlr = false

anuramat commented 1 year ago

Shouldn't this (diagnostic.hdlr) be disabled by default? I was definitely astonished by this, can't speak for others

dapc11 commented 1 year ago

Yes, it feels kind of intrusive to be honest.

ray-x commented 11 months ago

It was turned off by default. Please check the latest version.