rose-pine / neovim

Soho vibes for Neovim
MIT License
2.11k stars 132 forks source link

bug: Can't identify the selected text due to document highlights #277

Open s1n7ax opened 2 weeks ago

s1n7ax commented 2 weeks ago

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.

https://github.com/LazyVim/LazyVim/issues/3785

Repro

No response

mvllow commented 2 weeks ago

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 :)

s1n7ax commented 2 weeks ago

@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.

s1n7ax commented 2 weeks ago

@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
mvllow commented 2 weeks ago

Appreciate the info. I see two solutions here:

  1. 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.
  2. 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.

s1n7ax commented 2 weeks ago

@mvllow I like the first with Visual = { bg = palette.overlay }.

image

May be just a little contrasty fg gold color. Left: Visual = { bg = palette.overlay } Right: Visual = { fg = "#fab048", bg = palette.overlay } image

mvllow commented 2 weeks ago

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 :)

s1n7ax commented 2 weeks ago

@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.

image

Inverse of highlight seems appealing in visual mode image

But looks weird when in normal mode with cursor line

image

mirsella commented 4 days ago

hey i find Visual = { bg = "highlight_high" } pretty good too image

i was wondering how did you manage to use directly line like this Visual = { bg = palette.overlay } with lazyvim ? because the rose-pin plugin is not yet loaded in the opts field. Using the config field ?

mvllow commented 3 days ago

@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