rose-pine / neovim

Soho vibes for Neovim
MIT License
2.35k stars 149 forks source link

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

Open s1n7ax opened 5 months ago

s1n7ax commented 5 months 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 5 months 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 5 months 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 5 months 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 5 months 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 5 months 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 5 months 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 5 months 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 months 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 4 months 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

sjclayton commented 4 months ago

@mvllow

Any more thoughts on this? or are you still wanting to use overlay...?

mirsella commented 4 months ago

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

sjclayton commented 4 months ago

@mirsella

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.

mvllow commented 4 months ago

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

mvllow commented 3 months ago

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 },
    },
})