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

fix: set highlight group Subsitute #1983

Merged
merged 2 commits into from
May 19, 2024

Conversation

xiyaowong
Copy link
Collaborator

chore: remove the border of the custom highlights
It will be strange when multiple decoration ranges with borders are connected.

chore: remove the border of the custom highlights
      It will be strange when multiple decoration ranges with borders are connected.
@xiyaowong xiyaowong changed the title Hl substitute fix: set highlight group Subsitute May 19, 2024
@xiyaowong
Copy link
Collaborator Author

set icm=nosplit works, but sometimes the highlighing is wrong

Code_-_Insiders_RYU3vSr4BI.00_00_00-00_00_23.mp4

@xiyaowong
Copy link
Collaborator Author

xiyaowong commented May 19, 2024

set icm=nosplit works, but sometimes the highlighing is wrong

Hard to reproduce with #1976

-- But Search highlighting defaults to using VSCode ThemeColor, potentially with some opacity.
-- When the decoration is "virtText", having a background color with opacity can
-- cause the virtual text to blend with the original content.
Substitute = { fg='#282c34', bg='#98c379' },
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! We should offer a way to customize these colors if possible, though. I can imagine this color not showing very well on some light themes.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now it's possible, the setup_globals will only execute once, and users can define it themselves, requiring some delay for custom highlighting. However, indeed, there is a need to provide a more conventional approach.

Copy link
Collaborator

@ollien ollien May 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha, I guess I was thinking of allowing it via our configuration, but init.vim works too

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ollien
Copy link
Collaborator

ollien commented May 19, 2024

One thing I noticed, though I figure we can't do much about this, given VSCode owns the buffer, is that any substitutions that exceed the length of the original match will visually write over text later in the line. In Neovim, the original text is visually removed when typing your substitution.

Similarly (and this one I think we could fix), if your substitution exceeds the line length, it gets weirdly truncated.

image

@xiyaowong
Copy link
Collaborator Author

Merged, this PR has no side effects

@xiyaowong xiyaowong merged commit 479638f into vscode-neovim:master May 19, 2024
8 checks passed
@xiyaowong xiyaowong deleted the hl-Substitute branch May 19, 2024 15:38
@theol0403
Copy link
Member

Should we not be using vscode-neovim.highlightGroups.highlights to provide the default? Then we can pick theme colors.

@xiyaowong
Copy link
Collaborator Author

I originally used ThemeColor, but later found that the effect was not good

-- By default, it's linked to Search.
-- But Search highlighting defaults to using VSCode ThemeColor, potentially with some opacity.
-- When the decoration is "virtText", having a background color with opacity can
-- cause the virtual text to blend with the original content.
Substitute = { fg='#282c34', bg='#98c379' },

@theol0403
Copy link
Member

Just don't link it to Search, but provide the colors through package.json. That way it is configurable and you can access any ThemeColor you want.

@xiyaowong
Copy link
Collaborator Author

Sure. But now users can still set it in settings.json. If you want to add to this, that's fine with me.

@ollien
Copy link
Collaborator

ollien commented May 20, 2024

But now users can still set it in settings.json

How would users do that now? I can guess how they might do it in init.vim, but not settings.json

@xiyaowong
Copy link
Collaborator Author

But now users can still set it in settings.json

How would users do that now? I can guess how they might do it in init.vim, but not settings.json

https://github.com/vscode-neovim/vscode-neovim#-highlights

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

Successfully merging this pull request may close these issues.

bug: incremental highlights do not work if inccommand is not empty
3 participants