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

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

Closed
anatskiy opened this issue Sep 28, 2023 · 14 comments
Closed

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

anatskiy opened this issue Sep 28, 2023 · 14 comments
Labels
bug Something isn't working

Comments

@anatskiy
Copy link

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

@anatskiy anatskiy added the bug Something isn't working label Sep 28, 2023
@lukas-reineke
Copy link
Owner

lukas-reineke commented Sep 28, 2023

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
Copy link

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
Copy link
Owner

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
Copy link

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
Copy link

Pandoks commented Sep 28, 2023

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
Copy link

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`](https://github.com/catppuccin/nvim#integrations) 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
Copy link

@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
Copy link

Pandoks commented Sep 28, 2023

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
Copy link

fcancelinha commented Sep 28, 2023

@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
Copy link

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
Copy link

Pandoks commented Sep 28, 2023

@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
Copy link
Owner

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
Copy link
Author

anatskiy commented Sep 29, 2023

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
Copy link

nyngwang commented Oct 29, 2023

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

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants