ej-shafran / compile-mode.nvim

A plugin for Neovim inspired by Emacs' Compilation Mode
The Unlicense
81 stars 15 forks source link

`compile` and `recompile` require a `count` argument #17

Closed ptn closed 6 months ago

ptn commented 6 months ago

Describe the bug

I must invoke those functions like this:

require("compile-mode").compile({
  args = "./proj.local/test.sh " .. vim.fn.expand("%:p"),
  count = 0, -- <<<<<<<<<<<<<<<<<<
  smods = { vertical = true },
})

Otherwise I get this error:

E5108: Error executing lua: ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:18: The coroutine failed with this message: ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:18: The coroutine failed with this message: ...e/nvim/lazy/compile-mode.nvim/lua/compile-mode/utils.lua:87: attempt to concatenate local 'count' (a nil value)
stack traceback:
    [C]: in function 'error'
    ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:18: in function 'callback_or_next'
    ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:45: in function 'step'
    ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:48: in function 'execute'
    ...share/nvim/lazy/plenary.nvim/lua/plenary/async/async.lua:118: in function 'compile'
    /Users/ha/.config/nvim/lua/plugins/init.lua:160: in function </Users/ha/.config/nvim/lua/plugins/init.lua:155>

The error comes from these lines in split_unless_open.

To Reproduce Steps to reproduce the behavior:

  1. Open a buffer.
  2. Run :lua require("compile-mode").compile({ args = "an executable" })

Expected behavior One of these two things:

  1. Either the README mentions that a count is mandatory, in this section (for both compile and recompile).
  2. Change compile and recompile to add a default value of 0 to count.

Screenshots nope

Neovim Version

:!nvim -v
NVIM v0.10.0
Build type: Release
LuaJIT 2.1.1713773202
Run "nvim -V1 -v" for more info

compile-mode.nvim Version I'm running the latest branch.

Additional context nope