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

[BUG]Cannot restore the buffer that was created by cmake-tools #396

Open
qiyuewuyi2333 opened this issue Dec 5, 2024 · 6 comments
Open
Assignees
Labels
bug Something isn't working windows Windows related issues

Comments

@qiyuewuyi2333
Copy link

Describe the bug
I'm using a plugin for cmake project whose name is cmake-tools.nvim on windows.
And there is a command :CMakeRun to auto create a shell in a buffer below.
But when you trying to save a session with the buffer, and you restore the session. You will get the error below:

To Reproduce
On windows system, using the cmake-tools's command: CMakeRun,
Save the session
and next open the folder with the session was saved
And you will get the error on starting.

Expected behavior
No error here as linux.

Screenshots
The error message.
image

Checkhealth
image

**Baseline: **

  • Result of set sessionoptions?: sessionoptions=blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,localoptions

  • OS. win11

  • Neovim version nvim --version
    NVIM v0.10.1
    Build type: Release
    LuaJIT 2.1.1713484068

    system vimrc file: "$VIM/sysinit.vim"
    fall-back for $VIM: "C:/Program Files (x86)/nvim/share/nvim"

Run :checkhealth for more info

  • URL to your current config (if public)
@qiyuewuyi2333 qiyuewuyi2333 added the bug Something isn't working label Dec 5, 2024
@rmagatti rmagatti added windows Windows related issues help wanted Extra attention is needed labels Dec 5, 2024
@cameronr
Copy link
Collaborator

cameronr commented Dec 5, 2024

@qiyuewuyi2333 Thanks for the bug report. In order to help us debug, can you post the contents of session file associated with that error (C:\Users\86156\AppData\Local\nvim-data\sessions\F%3A%5Cdev%5CCG_Projects%5CHuan_Renderer_CPU.vim)?

And, just to confirm, you only get this error on Windows, right? It work correctly on Linux?

Can you also try with 0.10.2 to see if that changes anything?

@qiyuewuyi2333
Copy link
Author

Of cource, there is C:\Users\86156\AppData\Local\nvim-data\sessions\F%3A%5Cdev%5CCG_Projects%5CHuan_Renderer_CPU.vim:
F%3A%5Cdev%5CCG_Projects%5CHuan_Renderer_CPU.txt

For posting that, I trans the file format from .vim to .txt.

And yeah, I only get this error on windows. I'm using this plugin on my nvim on WSL, too, and it's working perfectly.

I just update my neovim version to 0.10.2, and I delete the old session and try again.
But there is also the error, same to 0.10.1.
nvim --version
NVIM v0.10.2
Build type: Release
LuaJIT 2.1.1713484068
Run "nvim -V1 -v" for more info

@qiyuewuyi2333 Thanks for the bug report. In order to help us debug, can you post the contents of session file associated with that error (C:\Users\86156\AppData\Local\nvim-data\sessions\F%3A%5Cdev%5CCG_Projects%5CHuan_Renderer_CPU.vim)?

And, just to confirm, you only get this error on Windows, right? It work correctly on Linux?

Can you also try with 0.10.2 to see if that changes anything?

@cameronr
Copy link
Collaborator

cameronr commented Dec 6, 2024

Thanks for that additional info. I spent some time digging into this and I think it's a bug in neovim, or, at the very least, a difference between how the :buffer command is handled on windows vs mac/linux.

If you try the following:

  1. run nvim --clean
  2. e [test]
  3. buffer \[test\]

step 3 will succeed on mac/linux but will fail on windows (no wsl) with a E94: No matching buffer for \[test\] error. That's essentially the error that you're getting. It seems like on windows (no wsl), the buffer command doesn't find buffers with [] even when they're escaped.

You can also verify that this isn't an auto-session bug by manually creating a session:

  1. Disable auto-session (add enabled = false, after "rmagatti/auto-session",)
  2. Open nvim and load your source file
  3. Run :CMakeRun
  4. manually save a session via :mks
  5. quit nvim
  6. run nvim -S session.vim

You'll get the same error message you're seeing in this issue

@qiyuewuyi2333
Copy link
Author

Thanks for that additional info. I spent some time digging into this and I think it's a bug in neovim, or, at the very least, a difference between how the :buffer command is handled on windows vs mac/linux.

If you try the following:

  1. run nvim --clean
  2. e [test]
  3. buffer \[test\]

step 3 will succeed on mac/linux but will fail on windows (no wsl) with a E94: No matching buffer for \[test\] error. That's essentially the error that you're getting. It seems like on windows (no wsl), the buffer command doesn't find buffers with [] even when they're escaped.

You can also verify that this isn't an auto-session bug by manually creating a session:

  1. Disable auto-session (add enabled = false, after "rmagatti/auto-session",)
  2. Open nvim and load your source file
  3. Run :CMakeRun
  4. manually save a session via :mks
  5. quit nvim
  6. run nvim -S session.vim

You'll get the same error message you're seeing in this issue

Really. You get the real reason of this error.
Now I could avoid this error by modifying the name of buffer.
But if it is a neovim error, shall I should make an issue for neovim?

@cameronr
Copy link
Collaborator

cameronr commented Dec 7, 2024

Yeah, probably worth filing a neovim issue. If you're really enterprising, you could take a look at the neovim source. I'm pretty sure the error is coming from this code:

https://github.com/neovim/neovim/blob/ec94c2704f5059794923777ed51412d80bd26b5b/src/nvim/buffer.c#L2273-L2373

@qiyuewuyi2333
Copy link
Author

Yeah, probably worth filing a neovim issue. If you're really enterprising, you could take a look at the neovim source. I'm pretty sure the error is coming from this code:

https://github.com/neovim/neovim/blob/ec94c2704f5059794923777ed51412d80bd26b5b/src/nvim/buffer.c#L2273-L2373

OK I made an issue to neovim.

@cameronr cameronr removed the help wanted Extra attention is needed label Dec 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working windows Windows related issues
Projects
None yet
Development

No branches or pull requests

3 participants