Closed omi-donlimit closed 2 years ago
I cannot reproduce this.
Can you make a minimal init.lua and a code example for which this happens?
I'm using AstroVim, here's the config file
local M = {}
function M.config()
local status_ok, indent_blankline = pcall(require, "indent_blankline")
if not status_ok then
return
end
vim.g.indentLine_enabled = 1
vim.g.indent_blankline_show_trailing_blankline_indent = true
vim.g.indent_blankline_show_first_indent_level = true
vim.g.indent_blankline_use_treesitter = true
vim.g.indent_blankline_show_current_context = true
vim.g.indent_blankline_char = "▏"
vim.g.indent_blankline_buftype_exclude = {
"nofile",
"terminal",
"lsp-installer",
"lspinfo",
}
vim.g.indent_blankline_filetype_exclude = {
"help",
"startify",
"dashboard",
"packer",
"neogitstatus",
"NvimTree",
"neo-tree",
"Trouble",
}
vim.g.indent_blankline_context_patterns = {
"class",
"return",
"function",
"method",
"^if",
"^while",
"jsx_element",
"^for",
"^object",
"^table",
"block",
"arguments",
"if_statement",
"else_clause",
"jsx_element",
"jsx_self_closing_element",
"try_statement",
"catch_clause",
"import_statement",
"operation_type",
}
vim.opt.list = true
vim.opt.listchars:append("space:⋅")
vim.opt.listchars:append("eol:↴")
indent_blankline.setup {
show_current_context = true,
show_current_context_start = false,
show_end_of_line = true,
space_char_blankline = " ",
}
end
return M
Can you also share the code from the screenshot? Or any code snipped where this happens
Happens on any code for me, lua or cpp code are what I've tested it with.
Snippet:
std::string Test() const
{
while (true)
{
std::string substr = s1.seq.substr(i, j);
if (substr.length() < min_size)
continue;
size_t pos = s2.seq.find(substr, 0);
while (pos != std::string::npos)
{
count++;
pos = s2.seq.find(substr, pos + 1);
}
}
return "";
}
Thank you, I can reproduce.
This happens because of vim.g.indent_blankline_use_treesitter = true
.
Treesitter indent isn't that great yet. Sometimes it makes these mistakes.
You can open an issue in the treesitter grammar repo. It's a bug there, not in indent-blankline.
I don't use treesitter for this myself, because of these issues. The default algorithm built into indent-blankline usually does a better job.
It should work fine if you do vim.g.indent_blankline_use_treesitter = false
Thank you! Im new to neovim, still migrating from vim.
Hi @lukas-reineke,
Not sure if I'm missing something, but I can still see indents on blank lines.
@chalmagean
What's your config look like? Did you vim.g.indent_blankline_use_treesitter = false
?
You have trailing whitespace on that line
You have trailing whitespace on that line
Yes. Exactly. I don't want to see indent guides there.
What's your config look like? Did you
vim.g.indent_blankline_use_treesitter = false
?
Is that different from the setup block? I thought that by putting it there, it was the same thing.
Yes. Exactly. I don't want to see indent guides there.
There is no way to turn this off. I explicitly don't hide it, so you don't miss it and can remove it. It's a feature not a bug.
Is that different from the setup block? I thought that by putting it there, it was the same thing.
Yes, it's the same thing
There is no way to turn this off. I explicitly don't hide it, so you don't miss it and can remove it. It's a feature not a bug.
I don't see the point of having both a dot to indicate whitespace, and the indent guide.
See line 47, that's an empty line and the
|
shouldnt appear. Using default config and tabs as indentation character with noexpandtab