bug: Can't identify the selected text due to document highlights
Opened this issue · 14 comments
Neovim version (nvim -v)
v0.11.0-dev+0e3e1e6
Terminal / multiplexer
Alacritty
Describe the bug
I have created a bug in LazyVim but it seems it's an issue in the colorscheme. You can find more information here.
Repro
No response
I'm not familiar with LazyVim but you should be able to override via:
require("rose-pine").setup({
highlight_groups = {
GroupName = { fg = "text", bg = "pine" } -- Or use a hex value
}
})
Happy to accept a PR that adds support for this in the theme :)
@mvllow I found the issue.
LspReferenceText
and Visual
both using palette.highlight_med
. If we can make a difference, then it's easy to identify because both highlights could exist at the same time.
@mvllow This is from the neovim documentation.
--- Note: Usage of |vim.lsp.buf.document_highlight()| requires the following highlight groups
--- to be defined or you won't be able to see the actual highlights.
--- |hl-LspReferenceText|
--- |hl-LspReferenceRead|
--- |hl-LspReferenceWrite|
function M.document_highlight()
local params = util.make_position_params()
request(ms.textDocument_documentHighlight, params)
end
Appreciate the info. I see two solutions here:
- Change Visual to "overlay". I tried this locally and it looks fine in my opinion. It matches CursorLine but I'm not sure if that's important since the cursorline doesn't seem to appear in visual mode. Not able to test how "highlight_med" looks with this, though.
- For higher contrast, we could use an accent color as the background, e.g.
LspReferenceText = { bg = "gold", fg = "text" }
.
If you're able to try either of these (or any other thoughts you may have) and share some screenshots of your favourite, I'm happy to implement it.
@mvllow I like the first with Visual = { bg = palette.overlay }
.
May be just a little contrasty fg
gold color.
Left: Visual = { bg = palette.overlay }
Right: Visual = { fg = "#fab048", bg = palette.overlay }
Thank you for the screenshots :) I do like the Visual being set to "overlay". The contrast isn't ideal but can be improved in the future—having something distinctive, even a little, is worth it.
I've played around with using different opacities of our "muted" colour to replace all of our highlight colours which may give us more flexibility for cases where we need more shades for a neutral background. I think you could test these via Visual = { bg = "muted", blend = 10 }
etc.
If I have time, I'll try the shades of "muted". Otherwise we'll go with "overlay" for Visual :)
@mvllow Visual = { bg = "muted", blend = 10 }
is very easy on my eye compared to overlay
. In both cases for some reason highlight_med
looks elevated like there is a drop shadow in my brain and Visual is not which is bit weird.
Inverse of highlight seems appealing in visual mode
But looks weird when in normal mode with cursor line
@mirsella I would do Visual = { bg = 'overlay' }
similar to your screenshot :) We do export our palette for use but honestly I've not had good luck using it directly. Possibly something we could improve in the future
@sjclayton no I'm good, i wasn't experienced with color scheme config in nvim, the method of just putting the name of the palette as string is perfectly fine ! oups thought it was me tagged 😅
I was asking the maintainer because I wanted to know if the plan was to have this added as default behavior or not.
Then it would be applied so it'd fix the issue for everyone, and you wouldn't have to do it in your config.
I think setting "Visual" to "overlay" is good :) You never know what else is linking to that group and if it will break things but life is short
Oh, the cursorline is set to "overlay"—that's probably why we used something different. I'm trying out this for visual:
require("rose-pine").setup({
highlight_groups = {
Visual = { bg = "iris", blend = 15 },
},
})