ej-shafran / compile-mode.nvim

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

[BUG] Plenary unable to open compile swap file on Windows #41

Open samwdp opened 6 days ago

samwdp commented 6 days ago

Existing Issues

Describe the bug

When running compile for the first time the error Error executing Lua callback: .../nvim-data/lazy/plenary.nvim/lua/plenary/async/async.lua:18: The coroutine failed with this message: .../nvim-data/lazy/plenary.nvim/lua/plenary/async/async.lua:18: The coroutine failed with this message: vim/_editor.lua:431: nvim_exec2(): Vim(sbuffer):E303: Unable to open swap file for "*compilation*", recovery impossible

image

Then when the *compilation* buffer is open and a Compile or Recompile command is run the output is correct image

I have already set my nvim directory by doing vim.opt.directory = "my_location" in my init.lua. I can see swap files created in there for the buffers I have open. I have no other issues with plugins that use Plenary

Steps To Reproduce

1. nvim on Windows
2. run Compile 1 time, you get an error then the compilation buffer is open
3. With an already open compilation buffer, run the compile command again or recompile
4. Close down the compilation buffer and then return to step 3

Expected Behavior

Complation buffer opens and output is shown

Neovim Version

NVIM v0.10.1
Build type: Release
LuaJIT 2.1.1713484068
Run "nvim -V1 -v" for more info

Plugin Version

nightly version as of 17/10/2024 21:58 UTC

Configuration

return {
    "ej-shafran/compile-mode.nvim",
    -- you can just use the latest version:
    branch = "nightly",
    -- or the most up-to-date updates:
    -- branch = "nightly",
    dependencies = {
        "nvim-lua/plenary.nvim",
        -- if you want to enable coloring of ANSI escape codes in
        -- compilation output, add:
        { "m00qek/baleia.nvim", tag = "v1.3.0" },
    },
    config = function()
        ---@type CompileModeOpts
        vim.g.compile_mode = {
            -- to add ANSI escape code support, add:
            baleia_setup = true,
        }
    end
}

Additional Context

compile-mode: require("compile-mode.health").check()

compile-mode.nvim report ~
- OK everything checks out
samwdp commented 5 days ago

After a bit more digging, I have found that changing the buffer name to a name without any asterisks in it stops this error. Not sure why this is so having the following config surpresses this error

return {
    "ej-shafran/compile-mode.nvim",
    -- you can just use the latest version:
    branch = "nightly",
    -- or the most up-to-date updates:
    -- branch = "nightly",
    dependencies = {
        "nvim-lua/plenary.nvim",
        -- if you want to enable coloring of ANSI escape codes in
        -- compilation output, add:
        { "m00qek/baleia.nvim", tag = "v1.3.0" },
    },
    config = function()
        ---@type CompileModeOpts
        vim.g.compile_mode = {
            buffer_name="compilation",
            -- to add ANSI escape code support, add:
            baleia_setup = true,
        }
    end
}
ej-shafran commented 4 days ago

Interesting. We've had issues with the asterisks in the buffer name in the past on Windows, but I believed I had fixed them (also, the Windows tests don't seem to show this issue). I'll try to give this a look.

ej-shafran commented 3 days ago

Can't seem to reproduce this error in the tests. Mind creating a reproduction in a container or something of the sort? Seems like the issue is pretty dang specific...