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

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

Open
s1n7ax opened this issue Jun 24, 2024 · 14 comments
Open

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

s1n7ax opened this issue Jun 24, 2024 · 14 comments
Labels

Comments

@s1n7ax
Copy link

s1n7ax commented Jun 24, 2024

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.

LazyVim/LazyVim#3785

Repro

No response

@s1n7ax s1n7ax added the bug label Jun 24, 2024
@mvllow
Copy link
Member

mvllow commented Jun 24, 2024

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
Copy link
Author

s1n7ax commented Jun 24, 2024

@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
Copy link
Author

s1n7ax commented Jun 24, 2024

@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
Copy link
Member

mvllow commented Jun 24, 2024

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
Copy link
Author

s1n7ax commented Jun 25, 2024

@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
Copy link
Member

mvllow commented Jun 25, 2024

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
Copy link
Author

s1n7ax commented Jun 25, 2024

@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
Copy link

mirsella commented Jul 8, 2024

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
Copy link
Member

mvllow commented Jul 9, 2024

@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
Copy link
Contributor

sjclayton commented Jul 22, 2024

@mvllow

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

@mirsella
Copy link

mirsella commented Jul 22, 2024

@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
Copy link
Contributor

@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
Copy link
Member

mvllow commented Jul 22, 2024

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
Copy link
Member

mvllow commented Aug 25, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants