lukas-reineke / indent-blankline.nvim

Indent guides for Neovim
MIT License
4.14k stars 102 forks source link

Excluding node type does not seem to have an effect #863

Closed defr0std closed 5 months ago

defr0std commented 5 months ago

Problem

Hi,

I am trying to exclude a certain node type from the indentation scope, so that the indent line is not drawn in that place.

Perhaps, I misunderstand the way the exclude list should work?

Steps to reproduce

I am editing the C++ source file like this:

class {
 public:
  void M() {
  }
 private:
};

Our style guide forces single space for public keyword, then there is a double space for actual functions and fields of the class.

I am trying to remove the indent line that goes from the public keyword down. This is the treesitter node called access_specifier, so I added this to the exclude list as so:

require("ibl").setup({
  indent = { char = "┊" },
  scope = {
    show_start = false,
    show_end = false,
    exclude = {
      node_type = {
        cpp = { "access_specifier" },
      },
    },
  },
})

However, the indent line for the scope is still drawn, resulting in the 3 lines inside void M(), which is not very pleasing: image

Expected behavior

The indent scope should not be created, or perhaps documentation should be extended to show how to exclude certain node types.

Neovim version (nvim -v)

NVIM v0.9.5 Build type: Release LuaJIT 2.1.1692716794

lukas-reineke commented 5 months ago

Please read :help ibl.config.scope. Scope is an additional highlight that shows the scope the cursor is in.

Normal indentation does not use treesitter. You cannot exclude a node type from normal indentation.