toppair / peek.nvim

Markdown preview plugin for Neovim
MIT License
651 stars 44 forks source link

Running PeekOpen gives "buffer exceeds maximum length" error #56

Closed V4G4X closed 8 months ago

V4G4X commented 8 months ago

Describe the bug The plugin seems to be installed correctly, Lazy.nvim didn't throw errors.
As I open a markdown file(226 lines) using PeekOpen, a small preview window opens briefly, and then crashes.
My nvim gives the following error:

Peek error: error: Uncaught (in promise) TypeError: buffer exceeds maximum length
            const action = decoder.decode(chunk.buffer);
                                   ^
    at TextDecoder.decode (ext:deno_web/08_text_encoding.js:165:18)
    at init (file:///Users/varungawande/.local/share/nvim/lazy/peek.nvim/public/main.bundle.js:86464:36)
    at eventLoopTick (ext:core/01_core.js:153:7)

To Reproduce

  1. Open a markdown file in nvim.
  2. Run :PeekOpen

Expected behavior I am expecting a preview of the markdown file to be shown.

Screenshots Error in nvim window:

Peek error: error: Uncaught (in promise) TypeError: buffer exceeds maximum length
            const action = decoder.decode(chunk.buffer);
                                   ^
    at TextDecoder.decode (ext:deno_web/08_text_encoding.js:165:18)
    at init (file:///Users/varungawande/.local/share/nvim/lazy/peek.nvim/public/main.bundle.js:86464:36)
    at eventLoopTick (ext:core/01_core.js:153:7)

Desktop (please complete the following information):

Run :checkhealth for more info

 - `deno --version`:

deno 1.40.5 (release, aarch64-apple-darwin) v8 12.1.285.27 typescript 5.3.3

 - plugin setup:
```lua
-- In Lazy.nvim
{
        "toppair/peek.nvim",
        event = { "VeryLazy" },
        build = "deno task --quiet build:fast",
        config = function()
            require("peek").setup()
            -- refer to `configuration to change defaults`
            vim.api.nvim_create_user_command("PeekOpen", require("peek").open, {})
            vim.api.nvim_create_user_command("PeekClose", require("peek").close, {})
        end,
    }

Additional context Add any other context about the problem here.

ElectronSutra commented 8 months ago

Corroborating, experiencing the same error.

Captured error:

21:13:17 │ Peek error: error: Uncaught (in promise) TypeError: buffer exceeds maximum length
            const action = decoder.decode(chunk.buffer);
                                   ^
    at TextDecoder.decode (ext:deno_web/08_text_encoding.js:165:18)
    at init (file:///Users/zacha/.local/share/nvim/site/pack/deps/opt/peek.nvim/public/main.bundle.js:86464:36)
    at eventLoopTick (ext:core/01_core.js:153:7)

Neovim v:

NVIM v0.10.0-dev-2465+ga7788c2e2
Build type: RelWithDebInfo
LuaJIT 2.1.1707061634

On MacOS with the most current Peek.

toppair commented 8 months ago

@V4G4X @ElectronSutra can you check if buffer branch works for you? You would install it like this if using lazy.nvim:

{
  "toppair/peek.nvim",
  branch = "buffer",
  build = "deno task --quiet build:fast",
  config = function()
    local peek = require("peek")
    peek.setup()
    vim.api.nvim_create_user_command("PeekOpen", peek.open, {})
    vim.api.nvim_create_user_command("PeekClose", peek.close, {})
  end
},
ElectronSutra commented 8 months ago

@ElectronSutra can you check if buffer branch works for you? You would install it like this if using lazy.nvim [...]

I installed on Neovim nightly using both lazy and echasnovski's mini.deps. I used the Daring Fireball md spec and a long personal document (class notes from an entire semester, over a hundred total headers).

Both worked successfully for me. Thank you!

V4G4X commented 8 months ago

It's running for me now too!