mrcjkb / haskell-tools.nvim

🦥 Supercharge your Haskell experience in neovim!
GNU General Public License v2.0
448 stars 17 forks source link

Curl progress bar leaking to stdout #309

Closed AntonVucinic closed 8 months ago

AntonVucinic commented 8 months ago

Neovim version (nvim -v)

v0.9.0

Operating system/version

Ubuntu 20.04.6 LTS

Output of :checkhealth haskell-tools

haskell-tools: require("haskell-tools.health").check()

Checking for Lua dependencies ~
- OK [nvim-telescope/telescope.nvim](https://github.com/nvim-telescope/telescope.nvim) installed.

Checking external dependencies ~
- OK haskell-language-server: found haskell-language-server version: 2.4.0.0 (GHC: 9.0.2) (PATH: /home/anton/.ghcup/hls/2.4.0.0/lib/haskell-language-server-2.4.0.0/bin/haskell-language-server-wrapper)
- WARNING       hoogle: not found.
  Install [ndmitchell/hoogle](https://github.com/ndmitchell/hoogle) for extended capabilities.
  Recommended for better Hoogle search performance.
  Without a local installation, the web API will be used by default.
  Required if the hoogle mode is set to "telescope-local".

- WARNING       fast-tags: not found.
  Install [fast-tags](https://hackage.haskell.org/package/fast-tags) for extended capabilities.
  Optional, for generating tags as a `tagfunc` fallback.

- OK curl: found curl 7.68.0 (x86_64-pc-linux-gnu) libcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh/0.9.3/openssl/zlib nghttp2/1.40.0 librtmp/2.3
- WARNING       haskell-debug-adapter: not found.
  Install [haskell-debug-adapter](https://github.com/phoityne/haskell-debug-adapter) for extended capabilities.
  Optional, for `dap` support.

- WARNING       ghci-dap: not found.
  Install [ghci-dap](https://github.com/phoityne/ghci-dap) for extended capabilities.
  Optional, for `dap` support.

Checking config ~
- OK vim.g.haskell_tools is not set
- OK No errors found in config.

Checking for conflicting plugins ~
- OK No conflicting plugins detected.

How to reproduce the issue

Install haskell tools and telescope. I'm guessing having a local hoogle installation would make this not work so make sure you don't have that also. Now try using hoogle search.

Expected behaviour

Open a telescope finder with results of hoogle search

Actual behaviour

An error is thrown because the curl progress bar somehow leaks to stdin. This could be a bug in curl because when I was testing it in a shell the progress bar never went to stdout, only stderr. Anyways after a quick look at the curl man page I found a -q option that supresses the progress bar. Tried it and it fixed the problem. If you want I can submit a pr.

Log files

DEBUG | 2023-12-18 15:50:45 | ...lazy/haskell-tools.nvim/lua/haskell-tools/hoogle/web.lua:84 | { "Hoogle web response", {    code = 0,    signal = 0,    stdout = "  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\n                                 Dload  Upload   Total   Spent    Left  Speed\n\r  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0\r  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0[{\"docs\": ...

The minimal config used to reproduce this issue.

local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
    "git",
    "clone",
    "--filter=blob:none",
    "https://github.com/folke/lazy.nvim.git",
    "--branch=stable",
    lazypath,
  })
end
vim.opt.rtp:prepend(lazypath)

require("lazy").setup({
  {
    'mrcjkb/haskell-tools.nvim',
    version = '^3',
    ft = { 'haskell', 'lhaskell', 'cabal', 'cabalproject' },
  },
  {
    'nvim-telescope/telescope.nvim',
    branch = '0.1.x',
    dependencies = { 
      'nvim-lua/plenary.nvim',
    },
    config = function()
      require('telescope').setup()
    end,
  },
})
mrcjkb commented 8 months ago

Hey :wave:

Thanks for the detailed report! A PR would be more than welcome :smile: Of course, I can fix it too if you're busy.