pwntester / octo.nvim

Edit and review GitHub issues and pull requests from the comfort of your favorite editor
MIT License
2.33k stars 125 forks source link

Octo review start fails with large pull requests #302

Open cj opened 2 years ago

cj commented 2 years ago

Issue Description

bug report

Describe what happened (or what feature you want)

When opening large pull requests :Octo review start fails with:

Error executing vim.schedule lua callback: Vim:E474: Trailing characters: [{"additions":11,"blob_url":"https://github.com/******/*****/blob/81b56f1be49c867d3274c60ce6a93626524cf496/packages%2Fui%2Ficons%2FDribble.tsx","changes":11,"contents_url":"https://api.github.com/repos/s
napnhd/snap-system/contents/packages%2Fui%2Ficons%2FDribble.tsx?ref=81b56f1be49c867d3274c60ce6a93626524cf496","deletions":0,"filename":"packages/ui/icons/Dribble.tsx","patch":"@@ -0,0 +1,11 @@\n+export function DribbleIcon() {\n+  return (\n+    \u003csvg className=\"h-6 w-6\" fill=\
"currentColor\" viewBox=\"0 0 24 24\"\u003e\n+      \u003cpath\n+        fillRule=\"evenodd\"\n+        d=\"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10c5.51 0 10-4.48 10-10S17.51 2 12 2zm6.605 4.61a8.502 8.502 0 011.93 5.314c-.281-.054-3.101-.629-5.943-.271-.065-.141-.12-.293-.184-.445a25
.416 25.416 0 00-.564-1.236c3.145-1.28 4.577-3.124 4.761-3.362zM12 3.475c2.17 0 4.154.813 5.662 2.148-.152.216-1.443 1.941-4.48 3.08-1.399-2.57-2.95-4.675-3.189-5A8.687 8.687 0 0112 3.475zm-3.633.803a53.896 53.896 0 013
stack traceback:
        [C]: in function 'json_decode'
        ...ack/packer/opt/octo.nvim/lua/octo/model/pull-request.lua:86: in function 'cb'
        ...nvim/site/pack/packer/opt/octo.nvim/lua/octo/gh/init.lua:92: in function ''
        vim/_editor.lua: in function <vim/_editor.lua:0>

Describe what you expected to happen

It to start the pr review.

How to reproduce it (as minimally and precisely as possible)

  1. Create pr with over 100 file changes
  2. Run :Octo review start

Tell us your environment

NVIM v0.7.0 Build type: Release LuaJIT 2.1.0-beta3 Compiled by linuxbrew@30f25fa6036f

Features: +acl +iconv +tui See ":help feature-compile"

system vimrc file: "$VIM/sysinit.vim" fall-back for $VIM: " /home/linuxbrew/.linuxbrew/Cellar/neovim/0.7.0/share/nvim"

Anything else we need to know?

gh.nvim had a similar issue https://github.com/ldelossa/gh.nvim/issues/8

pwntester commented 2 years ago

Thanks for reporting this, I can think of some workarounds piping the gh output into jq but I think its better to wait until gh implements array merging natively. This is actively being implemented so it should probably be released soon.

ref: https://github.com/cli/cli/pull/5652

jloesch30 commented 1 year ago

Do we have a temporary workaround for this at the moment? @pwntester I think you hinted at one and it looks like the cli PR you mentioned is gaining activity again

JohnCosta27 commented 1 year ago

Also experiencing this issue on large PRs

robsonpeixoto commented 6 months ago

I'm my tests the json_decode does not accept big strings. Maybe will be necessary implement a paginator instead of use the gh pagination feature