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

Diagnostics Info icon highlight group is incorrect: Expected "NvimTreeLspDiagnosticsInfo" but found "NvimTreeLspDiagnosticsInformation" #2516

Closed
juhaku opened this issue Nov 6, 2023 · 4 comments · Fixed by #2518
Labels
bug Something isn't working reproduced Issue confirmed

Comments

@juhaku
Copy link

juhaku commented Nov 6, 2023

Description

The diagnostics highlight group used for info icon is incorrect. NvimTree has set following highlight groups:

NvimTreeLspDiagnosticsWarningFolderText xxx links to NvimTreeLspDiagnosticsWarningText
NvimTreeLspDiagnosticsWarningText xxx links to NvimTreeLspDiagnosticsWarning
NvimTreeLspDiagnosticsErrorFolderText xxx links to NvimTreeLspDiagnosticsErrorText
NvimTreeLspDiagnosticsErrorText xxx links to NvimTreeLspDiagnosticsError
NvimTreeLspDiagnosticsInformation xxx links to DiagnosticInfo
...
NvimTreeLspDiagnosticsWarning xxx links to DiagnosticWarn
NvimTreeLspDiagnosticsError xxx links to DiagnosticError
NvimTreeLspDiagnosticsHint xxx links to DiagnosticHint

However the highlight group wanted for the info icon is NvimTreeLspDiagnosticsInfo as defined here:

M.ICON[vim.diagnostic.severity.INFO] = {
str = M.config.diagnostics.icons.info,
hl = { "NvimTreeLspDiagnosticsInfo" },
}
.

I assume the highlight group should be renamed to *Information or the NvimTree highlight groups should be corrected with *Info

Neovim version

NVIM v0.9.2
Build type: Release
LuaJIT 2.1.1694285958

Operating system and version

Linux 6.1.55-1-MANJARO

Windows variant

No response

nvim-tree version

master

Clean room replication

require("nvim-tree").setup({
	reload_on_bufenter = true,
	select_prompts = true,
	hijack_netrw = false,
	view = {
		width = 50,
	},
	renderer = {
		root_folder_label = ":~:s?$?/?",
		special_files = {},
		highlight_git = true,
		highlight_diagnostics = true,
		highlight_modified = "all",
		indent_markers = {
			enable = true,
		},
		icons = {
			show = {
				folder_arrow = true,
			},
		},
	},
	modified = {
		enable = true,
		show_on_dirs = true,
		show_on_open_dirs = true,
	},
	hijack_directories = {
		enable = false,
		auto_open = true,
	},
	update_focused_file = {
		enable = true,
	},
	diagnostics = {
		enable = true,
		show_on_dirs = true,
		show_on_open_dirs = true,
		debounce_delay = 50,
		icons = {
			hint = "",
			info = "",
			warning = "",
			error = "",
		},
	},
	filters = {
		git_ignored = true,
		dotfiles = true,
		git_clean = false,
		no_buffer = false,
		custom = {},
		exclude = {
			"node_modules",
		},
	},
	actions = {
		expand_all = {
			exclude = {
				"node_modules",
				"target",
				"build",
				".git",
			},
		},
	},
	tab = {
		sync = {
			open = true,
			close = true,
			ignore = {},
		},
	},
})

Steps to reproduce

  1. Open nvim with diagnostic enabled workspace (literally any project will do)
  2. Open nvim-tree and a file that has info level diagnostics available
  3. See results on the nvim-tree the icon color is not highlighted correctly but remains grey color.

Expected behavior

Should highlight color the icon according to used color theme:
image

Actual behavior

But the color remains grey:
image

@juhaku juhaku added the bug Something isn't working label Nov 6, 2023
@juhaku
Copy link
Author

juhaku commented Nov 6, 2023

Quick fix is to link the information highlight group with the info one and the nvim-tree highlights get fixed.

hi link NvimTreeLspDiagnosticsInfo NvimTreeLspDiagnosticsInformation

image

@alex-courtis
Copy link
Member

The highlights are somewhat problematic in their inconsistency. A proper overhaul is in progress #2415

The nvim build-in groups all use Info e.g. DiagnosticInfo, we should follow that pattern.

In the meantime we can class this as a bug: correct the icon's highlight group to match the documentation.

@alex-courtis
Copy link
Member

@juhaku thanks for finding this one.

I'd be grateful if you tested #2518

@alex-courtis alex-courtis added the reproduced Issue confirmed label Nov 6, 2023
@juhaku
Copy link
Author

juhaku commented Nov 6, 2023

@juhaku thanks for finding this one.

I'd be grateful if you tested #2518

@alex-courtis Yup, works like a magic, thanks for quick fix 🎉

alex-courtis added a commit that referenced this issue Nov 19, 2023
…n: NvimTreeLspDiagnosticsInfo -> Information (#2518)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working reproduced Issue confirmed
Projects
None yet
2 participants