Neovim crashes when editing cpp files and entering specific text.
To Reproduce
crash-min.cpp:
#include <vector>
class ANYTHING {
public:
private:
std::vector<int> a;
};
and here's init.lua:
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup({
spec={
"nvim-treesitter/nvim-treesitter",
config = function()
require('nvim-treesitter.configs').setup({
highlight = { enable = true },
ensure_installed = {
'c', 'cpp','css', 'html', 'javascript', 'typescript', 'tsx', 'lua', 'vim', 'vimdoc',
},
})
end
}
})
To reproduce:
nvim -u init.lua crash-min.cpp
After it launches:jjoconst
Expected behavior
It crashes and exits.
When open again with nvim -u init.lua crash-min.cpp, there's message like
E325: ATTENTION
Found a swap file by the name "~/.local/state/nvim/swap/%home%username%projects%crash%crash-min.cpp.swp"
......
Output of :checkhealth nvim-treesitter
Installation ~
OK tree-sitter found 0.22.6 (b40f342067a89cd6331bf4c27407588320f3c263) (parser generator, only needed for :TSInstallFromGrammar)
OK node found v20.15.0 (only needed for :TSInstallFromGrammar)
OK git executable found.
OK cc executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
Version: cc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
OK Neovim was compiled with tree-sitter runtime ABI version 14 (required >=13). Parsers must be compatible with runtime ABI.
OS Info:
{
machine = "x86_64",
release = "6.8.0-47-generic",
sysname = "Linux",
version = "#47~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Oct 2 16:16:55 UTC 2"
} ~
Parser/Features H L F I J
c ✓ ✓ ✓ ✓ ✓
cpp ✓ ✓ ✓ ✓ ✓
css ✓ . ✓ ✓ ✓
html ✓ ✓ ✓ ✓ ✓
javascript ✓ ✓ ✓ ✓ ✓
lua ✓ ✓ ✓ ✓ ✓
python ✓ ✓ ✓ ✓ ✓
tsx ✓ ✓ ✓ ✓ ✓
typescript ✓ ✓ ✓ ✓ ✓
vim ✓ ✓ ✓ . ✓
vimdoc ✓ . . . ✓
Legend: H[ighlight], L[ocals], F[olds], I[ndents], In[j]ections
+) multiple parsers found, only one will be used
x) errors found in the query, try to run :TSUpdate {lang} ~
Output of nvim --version
NVIM v0.11.0-dev
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Run "nvim -V1 -v" for more info
Additional context
There are other words can trigger this but i forget to record. All happens when deal with cpp and hpp files.
Describe the bug
Neovim crashes when editing cpp files and entering specific text.
To Reproduce
crash-min.cpp
:and here's
init.lua
:To reproduce:
nvim -u init.lua crash-min.cpp
After it launches:jjoconst
Expected behavior
It crashes and exits. When open again with
nvim -u init.lua crash-min.cpp
, there's message like E325: ATTENTION Found a swap file by the name "~/.local/state/nvim/swap/%home%username%projects%crash%crash-min.cpp.swp" ......Output of
:checkhealth nvim-treesitter
Installation ~
tree-sitter
found 0.22.6 (b40f342067a89cd6331bf4c27407588320f3c263) (parser generator, only needed for :TSInstallFromGrammar)node
found v20.15.0 (only needed for :TSInstallFromGrammar)git
executable found.cc
executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" } Version: cc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0OS Info: { machine = "x86_64", release = "6.8.0-47-generic", sysname = "Linux", version = "#47~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Oct 2 16:16:55 UTC 2" } ~
Parser/Features H L F I J
vimdoc ✓ . . . ✓
Legend: H[ighlight], L[ocals], F[olds], I[ndents], In[j]ections +) multiple parsers found, only one will be used x) errors found in the query, try to run :TSUpdate {lang} ~
Output of
nvim --version
NVIM v0.11.0-dev Build type: RelWithDebInfo LuaJIT 2.1.0-beta3 Run "nvim -V1 -v" for more info
Additional context
There are other words can trigger this but i forget to record. All happens when deal with cpp and hpp files.