lukas-reineke / indent-blankline.nvim

Indent guides for Neovim
MIT License
4.06k stars 100 forks source link

Current scope is not highlighted after the upgrade to v3 #643

Closed anatskiy closed 11 months ago

anatskiy commented 11 months ago

Problem

This may be not a bug, but I couldn't find an answer in the documentation (by text search, at least) about how to highlight the current scope. Treesitter is, of course, configured in the main config.

Screenshot 2023-09-28 at 11 25 52

Steps to reproduce

nvim --clean -u ./min-init.lua min-init.lua

Expected behavior

The current scope's indent line is bold or something.

Neovim version (nvim -v)

0.9.2

lukas-reineke commented 11 months ago

Please use the minimal config template to provide a fully reproducible example.

If you specifically mean the place in the screenshot, this is expected. The tables in the setup call are not scopes. Please read the definition in the docs, :help ibl.config.scope

fcancelinha commented 11 months ago

I'm also facing this issue, but I've noticed that "Scope" only applies to where variables are reachable, and it's language gnostic. So my question is, how do I highlight the current scope I'm at , regardless ?

lukas-reineke commented 11 months ago

So my question is, how do I highlight the current scope I'm at , regardless ?

You can add additional node types with :help ibl.config.scope.include

fcancelinha commented 11 months ago

So my question is, how do I highlight the current scope I'm at , regardless ?

You can add additional node types with :help ibl.config.scope.include

Thank you, and this plugin is great, thank you for your hard work.

Pandoks commented 11 months ago

This is my config right now:

return {
    "lukas-reineke/indent-blankline.nvim",
    main = "ibl",
    opts = {
        scope = {
            show_start = false,
            include = {
                node_type = { "*" },
            },
        },
        indent = {
            char = "│",
        },
    },
}
image

I'm working with catppuccin colorscheme. How do I make the line highlighted for the old versioned "scope" or "context"?

fcancelinha commented 11 months ago

This is my config right now:

return {
  "lukas-reineke/indent-blankline.nvim",
  main = "ibl",
  opts = {
      scope = {
          show_start = false,
          include = {
              node_type = { "*" },
          },
      },
      indent = {
          char = "│",
      },
  },
}
image

I'm working with catppuccin colorscheme. How do I make the line highlighted for the old versioned "scope" or "context"?

you can use something like this

image

You may find the highlight node_types by doing :InspectTree

fcancelinha commented 11 months ago

@lukas-reineke Would it be possible to implement a wild character as a value of the wild character table to indicate that all scopes should be highlighted ? Would performance be impacted considerably ?

Pandoks commented 11 months ago

Seems to be a colorscheme issue with catppuccin. It works without a colorscheme. I'll open either an issue or pr on their repo.

image
fcancelinha commented 11 months ago

@Pandoks you need to setup the highlight groups

for example:

image

Check the documentation by typing :help indent-blankline

-- edit --

also, the node_type should not contain ^ characters, this is something I did to turn on or off some node_types

this example would be much better

image

OneOfOne commented 11 months ago

IMO It should default to all scopes like it used to then have an option to disable them, not the other way around, for now I'm sticking to mini.indentscope.

Pandoks commented 11 months ago

@Pandoks you need to setup the highlight groups

for example:

image

Check the documentation by typing :help indent-blankline

What is "Function" and "Local"?

lukas-reineke commented 11 months ago

IMO It should default to all scopes like it used to then have an option to disable them, not the other way around

That is not the point of scope. The scope is the actual program scope, as in https://en.wikipedia.org/wiki/Scope_(computer_science) This is explained in the documentation as well :help ibl.config.scope

Would it be possible to implement a wild character as a value of the wild character table to indicate that all scopes should be highlighted ?

I added this in https://github.com/lukas-reineke/indent-blankline.nvim/releases/tag/v3.2.0 but it can lead to weird behavior, use it with a grain of salt.

What is "Function" and "Local"?

They are :help highlight-groups

anatskiy commented 11 months ago

Seems to be a colorscheme issue with catppuccin. It works without a colorscheme. I'll open either an issue or pr on their repo. image

There's indeed a problem with mismatching highlight groups in indent-blankline v3.x and catppuccin. This can be fixed by adding the following to the catppuccin's config table (colors correspond to the old ones for indent-blankline v2):

local config = {
  custom_highlights = function(colors)
    return {
      IblIndent = { fg = colors.surface0 },
      IblScope = { fg = colors.text },
    }
  end,
}

These fixes combined with the most recent wildcard change in indent-blankline v3.2 bring back the desired behavior:

Screenshot 2023-09-29 at 08 38 32

Thanks @lukas-reineke for a very nice plugin!

P.S. In the original issue description, I used one of the standard built-in color schemes, which doesn't even have the needed highlight groups at all, thus, no highlighting of the current indentation level. No surprise here.

nyngwang commented 10 months ago

What should I do to remove the scope highlight for the first line?

image