Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling REST endpoint with debugging breakpoint causes Neovim to become unresponsive #323

Open
h3ndry opened this issue Mar 21, 2024 · 2 comments

Comments

@h3ndry
Copy link

h3ndry commented Mar 21, 2024

I have setup a simple fast API demo project to reproduce this https://github.com/h3ndry/rest-nvim-test

Neovim Version

NVIM v0.9.5
Build type: Release
LuaJIT 2.1.1692716794

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/share/nvim"

Run :checkhealth for more info

Rest config

return {
  {
    'vhyrro/luarocks.nvim',
    config = function()
      require('luarocks').setup {}
    end,
  },
  {
    'rest-nvim/rest.nvim',
    ft = 'http',
    opts = {
      encode_url = false,
      keybinds = {
        {
          '<localleader>rr',
          '<cmd>Rest run<cr>',
          'Run request under the cursor',
        },
        {
          '<localleader>rl',
          '<cmd>Rest run last<cr>',
          'Re-run latest request',
        },
      },
    },
    dependencies = { 'luarocks.nvim' },
    config = function(_, opts)
      require('rest-nvim').setup(opts)
    end,
  },
}

python debug config

    require('dap-python').setup '/home/hendry/.virtualenvs/debugpy/bin/python'
    dap.configurations.lua = {
      {
        type = 'nlua',
        request = 'attach',
        name = 'Attach to running Neovim instance',
      },
    }
    dap.adapters.nlua = function(callback, config)
      callback { type = 'server', host = config.host or '127.0.0.1', port = config.port or 8086 }
    end
  end,

Steps to reproduce

  1. Add a breakpoint inside the function to be called
  2. start your debug server or debug the file using the nvim python debug
  3. Call the endpoint you are debugging using REST.NVIM

I have tested using the old version and curl, all seems to work except when using this plugin

@Ajetski
Copy link

Ajetski commented Apr 24, 2024

I have reproduced this issue (its not specific to fast-api/python). The http call is blocking the UI thread. It should be possible to spawn an async job/task for that http call to fix this.

@jonathan-elize
Copy link

Yes I can confirm on the UI freezing while the call goes on. Hoping this can get fixed. I poked through the source code and saw there was some logic to use nvim-nio to. But this doesn't seem to help either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants