gruvbox-material
gruvbox-material copied to clipboard
Native Inlay hints are very dark
I have done the following steps before reporting this issue:
- [X] I have searched the existing issues
- [X] I have read the FAQ in the help doc
Operating system/version
Fedora Linux 39
Terminal emulator/version
wezterm 20231203-124028-e3cd2e93
$TERM environment variable
xterm-256color
Tmux version
No response
Feature matrix
==============================================================================
gitsigns: require("gitsigns.health").check()
- OK git version 2.43.0
==============================================================================
lazy: require("lazy.health").check()
lazy.nvim ~
- OK Git installed
- OK no existing packages found by other package managers
- OK packer_compiled.lua not found
==============================================================================
mason: require("mason.health").check()
mason.nvim ~
- OK mason.nvim version v1.8.3
- OK PATH: prepend
- OK Providers:
mason.providers.registry-api
mason.providers.client
- OK neovim version >= 0.7.0
mason.nvim [Registries] ~
- OK Registry `github.com/mason-org/mason-registry version: 2024-01-04-worn-weeder` is installed.
mason.nvim [Core utils] ~
- OK unzip: `UnZip 6.00 of 20 April 2009, by Info-ZIP. Maintained by C. Spieler. Send`
- OK wget: `GNU Wget 1.21.3 byggd på linux-gnu.`
- OK curl: `curl 8.2.1 (x86_64-redhat-linux-gnu) libcurl/8.2.1 OpenSSL/3.1.1 zlib/1.2.13 brotli/1.1.0 libidn2/2.3.4 libpsl/0.21.2 (+libidn2/2.3.4) libssh/0.10.6/openssl/zlib nghttp2/1.55.1 OpenLDAP/2.6.6`
- OK gzip: `gzip 1.12`
- OK gtar: `tar (GNU tar) 1.35`
- OK bash: `GNU bash, version 5.2.21(1)-release (x86_64-redhat-linux-gnu)`
- OK sh: `Ok`
mason.nvim [Languages] ~
- WARNING luarocks: not available
- ADVICE:
- spawn: luarocks failed with exit code - and signal -. luarocks is not executable
- WARNING Composer: not available
- ADVICE:
- spawn: composer failed with exit code - and signal -. composer is not executable
- WARNING PHP: not available
- ADVICE:
- spawn: php failed with exit code - and signal -. php is not executable
- OK Go: `go version go1.21.5 linux/amd64`
- OK Ruby: `ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux]`
- OK node: `v20.10.0`
- OK cargo: `cargo 1.75.0 (1d8b05cdd 2023-11-20)`
- WARNING julia: not available
- ADVICE:
- spawn: julia failed with exit code - and signal -. julia is not executable
- OK python: `Python 3.12.1`
- OK java: `openjdk version "21.0.1" 2023-10-17`
- OK RubyGem: `3.4.10`
- OK javac: `javac 17.0.9`
- OK pip: `pip 23.2.1 from /usr/lib/python3.12/site-packages/pip (python 3.12)`
- OK npm: `10.2.3`
- OK python venv: `Ok`
mason.nvim [GitHub] ~
- OK GitHub API rate limit. Used: 1. Remaining: 59. Limit: 60. Reset: tor 4 jan 2024 15:50:39.
Install and authenticate via gh-cli to increase rate limit.
==============================================================================
nvim: require("nvim.health").check()
Configuration ~
- OK no issues found
Runtime ~
- OK $VIMRUNTIME: /tmp/.mount_nvim.aAn8sAe/usr/share/nvim/runtime
Performance ~
- OK Build type: RelWithDebInfo
Remote Plugins ~
- OK Up to date
terminal ~
- key_backspace (kbs) terminfo entry: `key_backspace=\177`
- key_dc (kdch1) terminfo entry: `key_dc=\E[3~`
- $TERM_PROGRAM="WezTerm"
- $COLORTERM="truecolor"
==============================================================================
nvim-treesitter: require("nvim-treesitter.health").check()
Installation ~
- OK `tree-sitter` found 0.20.8 (parser generator, only needed for :TSInstallFromGrammar)
- OK `node` found v20.10.0 (only needed for :TSInstallFromGrammar)
- OK `git` executable found.
- OK `cc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
Version: cc (GCC) 13.2.1 20231205 (Red Hat 13.2.1-6)
- OK Neovim was compiled with tree-sitter runtime ABI version 14 (required >=13). Parsers must be compatible with runtime ABI.
OS Info:
{
machine = "x86_64",
release = "6.6.8-200.fc39.x86_64",
sysname = "Linux",
version = "#1 SMP PREEMPT_DYNAMIC Thu Dec 21 04:01:49 UTC 2023"
} ~
Parser/Features H L F I J
- bash ✓ ✓ ✓ . ✓
- c ✓ ✓ ✓ ✓ ✓
- diff ✓ . . . .
- dockerfile ✓ . . . ✓
- go ✓ ✓ ✓ ✓ ✓
- html ✓ ✓ ✓ ✓ ✓
- java ✓ ✓ ✓ ✓ ✓
- json ✓ ✓ ✓ ✓ .
- lua ✓ ✓ ✓ ✓ ✓
- markdown ✓ . ✓ ✓ ✓
- markdown_inline ✓ . . . ✓
- perl ✓ . ✓ . ✓
- python ✓ ✓ ✓ ✓ ✓
- query ✓ ✓ ✓ ✓ ✓
- rust ✓ ✓ ✓ ✓ ✓
- typescript ✓ ✓ ✓ ✓ ✓
- vim ✓ ✓ ✓ . ✓
- vimdoc x . . . ✓
- yaml ✓ ✓ ✓ ✓ ✓
Legend: H[ighlight], L[ocals], F[olds], I[ndents], In[j]ections
+) multiple parsers found, only one will be used
x) errors found in the query, try to run :TSUpdate {lang} ~
The following errors have been detected: ~
- ERROR vimdoc(highlights): ...8sAe/usr/share/nvim/runtime/lua/vim/treesitter/query.lua:248: Query error at 26:3. Invalid node type "note":
((note) @text.note
^
vimdoc(highlights) is concatenated from the following files:
| [ERROR]:"/home/snaggen/.local/share/nvim/lazy/nvim-treesitter/queries/vimdoc/highlights.scm", failed to load: ...8sAe/usr/share/nvim/runtime/lua/vim/treesitter/query.lua:248: Query error at 26:3. Invalid node type "note":
((note) @text.note
^
==============================================================================
provider.clipboard: require("provider.clipboard.health").check()
Clipboard (optional) ~
- OK Clipboard tool found: wl-copy
==============================================================================
provider.node: require("provider.node.health").check()
Node.js provider (optional) ~
- Node.js: v20.10.0
- WARNING Missing "neovim" npm (or yarn, pnpm) package.
- ADVICE:
- Run in shell: npm install -g neovim
- Run in shell (if you use yarn): yarn global add neovim
- Run in shell (if you use pnpm): pnpm install -g neovim
- You may disable this provider (and warning) by adding `let g:loaded_node_provider = 0` to your init.vim
==============================================================================
provider.perl: require("provider.perl.health").check()
Perl provider (optional) ~
- WARNING "Neovim::Ext" cpan module is not installed
- ADVICE:
- See :help |provider-perl| for more information.
- You may disable this provider (and warning) by adding `let g:loaded_perl_provider = 0` to your init.vim
==============================================================================
provider.python: require("provider.python.health").check()
Python 3 provider (optional) ~
- WARNING No Python executable found that can `import neovim`. Using the first available executable for diagnostics.
- WARNING Could not load Python 3:
/usr/bin/python3 does not have the "neovim" module.
/usr/bin/python3.12 does not have the "neovim" module.
python3.11 not found in search path or not executable.
python3.10 not found in search path or not executable.
python3.9 not found in search path or not executable.
python3.8 not found in search path or not executable.
python3.7 not found in search path or not executable.
/usr/bin/python does not have the "neovim" module.
- ADVICE:
- See :help |provider-python| for more information.
- You may disable this provider (and warning) by adding `let g:loaded_python3_provider = 0` to your init.vim
- Executable: Not found
Python virtualenv ~
- OK no $VIRTUAL_ENV
==============================================================================
provider.ruby: require("provider.ruby.health").check()
Ruby provider (optional) ~
- Ruby: ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux]
- WARNING `neovim-ruby-host` not found.
- ADVICE:
- Run `gem install neovim` to ensure the neovim RubyGem is installed.
- Run `gem environment` to ensure the gem bin directory is in $PATH.
- If you are using rvm/rbenv/chruby, try "rehashing".
- See :help |g:ruby_host_prog| for non-standard gem installations.
- You may disable this provider (and warning) by adding `let g:loaded_ruby_provider = 0` to your init.vim
==============================================================================
telescope: health#telescope#check
Checking for required plugins ~
- OK plenary installed.
- OK nvim-treesitter installed.
Checking external dependencies ~
- OK rg: found ripgrep 13.0.0
- OK fd: found fd 8.7.1
===== Installed extensions ===== ~
==============================================================================
vim.lsp: require("vim.lsp.health").check()
- LSP log level : WARN
- Log path: /home/snaggen/.local/state/nvim/lsp.log
- Log size: 58794 KB
vim.lsp: Active Clients ~
- rust_analyzer (id=1, root_dir=~/src/tokio-stomp-2, attached_to=[1])
==============================================================================
vim.treesitter: require("vim.treesitter.health").check()
- Nvim runtime ABI version: 14
- OK Parser: bash ABI: 14, path: /home/snaggen/.local/share/nvim/lazy/nvim-treesitter/parser/bash.so
- OK Parser: diff ABI: 14, path: /home/snaggen/.local/share/nvim/lazy/nvim-treesitter/parser/diff.so
- OK Parser: dockerfile ABI: 14, path: /home/snaggen/.local/share/nvim/lazy/nvim-treesitter/parser/dockerfile.so
- OK Parser: go ABI: 14, path: /home/snaggen/.local/share/nvim/lazy/nvim-treesitter/parser/go.so
- OK Parser: html ABI: 14, path: /home/snaggen/.local/share/nvim/lazy/nvim-treesitter/parser/html.so
- OK Parser: java ABI: 14, path: /home/snaggen/.local/share/nvim/lazy/nvim-treesitter/parser/java.so
- OK Parser: json ABI: 14, path: /home/snaggen/.local/share/nvim/lazy/nvim-treesitter/parser/json.so
- OK Parser: lua ABI: 14, path: /home/snaggen/.local/share/nvim/lazy/nvim-treesitter/parser/lua.so
- OK Parser: perl ABI: 14, path: /home/snaggen/.local/share/nvim/lazy/nvim-treesitter/parser/perl.so
- OK Parser: rust ABI: 14, path: /home/snaggen/.local/share/nvim/lazy/nvim-treesitter/parser/rust.so
- OK Parser: typescript ABI: 14, path: /home/snaggen/.local/share/nvim/lazy/nvim-treesitter/parser/typescript.so
- OK Parser: yaml ABI: 13, path: /home/snaggen/.local/share/nvim/lazy/nvim-treesitter/parser/yaml.so
- OK Parser: bash ABI: 14, path: /tmp/.mount_nvim.aAn8sAe/usr/lib/nvim/parser/bash.so
- OK Parser: c ABI: 14, path: /tmp/.mount_nvim.aAn8sAe/usr/lib/nvim/parser/c.so
- OK Parser: lua ABI: 14, path: /tmp/.mount_nvim.aAn8sAe/usr/lib/nvim/parser/lua.so
- OK Parser: markdown ABI: 14, path: /tmp/.mount_nvim.aAn8sAe/usr/lib/nvim/parser/markdown.so
- OK Parser: markdown_inline ABI: 14, path: /tmp/.mount_nvim.aAn8sAe/usr/lib/nvim/parser/markdown_inline.so
- OK Parser: python ABI: 14, path: /tmp/.mount_nvim.aAn8sAe/usr/lib/nvim/parser/python.so
- OK Parser: query ABI: 14, path: /tmp/.mount_nvim.aAn8sAe/usr/lib/nvim/parser/query.so
- OK Parser: vim ABI: 14, path: /tmp/.mount_nvim.aAn8sAe/usr/lib/nvim/parser/vim.so
- OK Parser: vimdoc ABI: 14, path: /tmp/.mount_nvim.aAn8sAe/usr/lib/nvim/parser/vimdoc.so
Minimal vimrc that can reproduce this bug.
The important part is
if client.server_capabilities.inlayHintProvider then
vim.lsp.inlay_hint.enable(ev.buf, true);
end
To get a more readable I use this
if client.server_capabilities.inlayHintProvider then
-- Material Gruvbox grey0
vim.api.nvim_set_hl(0, "LspInlayHint", { fg = "#7c6f64", italic = false });
vim.lsp.inlay_hint.enable(ev.buf, true);
end
Steps to reproduce this bug using minimal vimrc
Having an lsp with inlay hints configured, you can just open a file that uses that LSP
Expected behavior
The version where I fixed it using grey0 it looks like this (which I prefer)
Actual behavior
The default color for the Inlay hints look like this
Grey0 is very close to comment colors, which is difficult to distinguish from.
I’m considering adding a background color along with grey0 foreground colors, and make this behavior as a configuration option. @antoineco what do you think?
With rust-tools I actually had the same color for the virtual text based inlay hints as the comments. That was not a very big issue, since it is quite clear which is which just on the placement. This is getting even more clear with the native inlay hint. And, with grey0 for inlay hints, the comment is noticeably brighter so I do not see a huge issue confusing them.
However, I'm not good with aesthetics, so if you are able to do something that is more clear and better looking, I'm not going to stop you. But keep in mind, that there are a lot of inlay hints (at least in some languages like rust) and they are going to be mixed in with the code. So you probably want something subtle that doesn't steal that much attention.
This is a sample so you can see a full rust function with a comment on top, to see how it looks now for me with grey0.
@sainnhe I don't use inlay hints and I'm unfortunately not available this week, so I don't have an opinion to share right now. I can look into it next week though.
@antoineco No problem! I'm going to deal with this issue, have a nice time :)
Sorry for late reply.
What if using inline comments like this? In many situations, using grey in inlay hints is not very distinguishable. A basic responsibility for a color scheme is making different elements easy to be distinguish from.
IMO, compared to using grey0 as foreground color, it might be better to have a background color like this:
Or colored bg:
Or darker bg:
I'm going to adding a configuration option to allow users adjust the style of inlay hints. If you are not satisfied with this, you can fork this repository and modify the code yourself.
What I mean is that inlay hints are just a hint, not something that should grab to much attention. And, I do not see them that semantically different than a comment, so I think it makes sense for them to be similar to comments. But, as you point out, you are free to choose what is best, and I'm sure you are better than me when it comes to styling and aesthetics. I'm just giving my input as a developer that rely on inlay hints a lot.
I recently started using LSP inlay hints in Neovim, and I have to agree with the sentiment that using the same color as comments is visually confusing.
As much as I understand that the inlay text may feel too dark to some people, we need to default to something unobtrusive and avoid mixing semantics.
Luckily, it is fairly simple to override the colorscheme's defaults using an autocmd
. This approach has the advantage of applying only to the colorscheme that matches the given pattern
, so it is possible to switch conveniently between colorschemes without having to modify the Neovim configuration that way:
https://github.com/sainnhe/gruvbox-material/blob/5256b758ef8274e33ae847b17188bf8623cf33e0/doc/gruvbox-material.txt#L676-L690
For this particular request, I suggest declaring the following autocmd
inside init.lua
:
vim.api.nvim_create_autocmd('ColorScheme', {
group = vim.api.nvim_create_augroup('custom_highlights_gruvboxmaterial', {}),
pattern = 'gruvbox-material',
callback = function()
local config = vim.fn['gruvbox_material#get_configuration']()
local palette = vim.fn['gruvbox_material#get_palette'](config.background, config.foreground, config.colors_override)
local set_hl = vim.fn['gruvbox_material#highlight']
set_hl('LspInlayHint', palette.grey1, palette.none)
end
})