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

Regarding the color issue of inlay_hint #63

Closed
jinzhongjia opened this issue Oct 19, 2023 · 16 comments · Fixed by #77
Closed

Regarding the color issue of inlay_hint #63

jinzhongjia opened this issue Oct 19, 2023 · 16 comments · Fixed by #77

Comments

@jinzhongjia
Copy link

Its background color is the same as the annotation, so it doesn't look clear enough. Maybe we can make the difference by deepening the background color of inlay_hint.

image

@uloco
Copy link
Owner

uloco commented Oct 19, 2023

I see. How about reversing colors? So bg and fg switch?

@jinzhongjia
Copy link
Author

this theme https://github.com/projekt0n/github-nvim-theme do like this:
image

I don’t know much about neovim’s color. It seems like the bg is accentuated.

@jinzhongjia
Copy link
Author

in https://github.com/Mofiqul/vscode.nvim, like this:
image
Annotations and inlayhint colors are completely different

@jinzhongjia
Copy link
Author

this theme https://github.com/projekt0n/github-nvim-theme do like this: image

I don’t know much about neovim’s color. It seems like the bg is accentuated.

I think we can directly refer to its processing method, and the workload should be minimal.

@uloco
Copy link
Owner

uloco commented Oct 22, 2023

this theme https://github.com/projekt0n/github-nvim-theme do like this: image

I don’t know much about neovim’s color. It seems like the bg is accentuated.

I think we can directly refer to its processing method, and the workload should be minimal.

This one looks good

@jinzhongjia jinzhongjia closed this as not planned Won't fix, can't repro, duplicate, stale Dec 1, 2023
@uloco
Copy link
Owner

uloco commented Dec 1, 2023

I was planning to add this at some point... did you solve it other way or why did you close?

@uloco uloco reopened this Dec 1, 2023
@jinzhongjia
Copy link
Author

This issue hasn't changed for a long time. I thought you didn't plan to add this feature.
Now I’m looking forward to the new features in the future

@uloco
Copy link
Owner

uloco commented Dec 2, 2023

Just a lot on my plate. But I want to close all issues at some point ;)

@hankertrix
Copy link
Contributor

hankertrix commented Jan 21, 2024

this theme https://github.com/projekt0n/github-nvim-theme do like this: image

I don’t know much about neovim’s color. It seems like the bg is accentuated.


This theme uses the LspInlayHint highlight group to implement it, here's the code:
https://github.com/projekt0n/github-nvim-theme/blob/067cb69b93957ace0d0d83811453b401d1fb672c/lua/github-theme/group/modules/native_lsp.lua#L19

All we need now is a suitable background colour for both the dark theme and the light theme and it should be done.

@uloco
Copy link
Owner

uloco commented Jan 22, 2024

I want to test this but couldn't figure out how to enable the inlay hints....

@hankertrix
Copy link
Contributor

hankertrix commented Jan 23, 2024

I looked around and found that inlay hints are a Neovim nightly feature.
nvimdev/lspsaga.nvim#1204

He uses his own plugin called LspUI in his configuration, and I'm not sure if his plugin uses Neovim nightly or Neovim stable, but installing his plugin might allow you to test it:
https://github.com/jinzhongjia/LspUI.nvim

@jinzhongjia would you mind providing a minimal config to display the inlay hints as well as some code examples to test it?

@jinzhongjia
Copy link
Author

first, add this to lua_ls config(I use nevim-lspconfig), this will request lua_ls enable inlay_hint feature

    settings = {
        Lua = {
            hint = {
                enable = true,
                arrayIndex = "Enable",
                setType = true,
            },
            workspace = {
                checkThirdParty = false,
            },
        },
    },

Then install neovim nightly, and you can use this to enable inlay_hint easily:
:lua vim.lsp.inlay_hint.enable(0, true)
It will enable inlay_hint for current buffer(current buffer be represented by 0 )

use this to disable inaly_hint :lua vim.lsp.inlay_hint.enable(0, false)

@jinzhongjia
Copy link
Author

The inlay_hint of my plugin is just a package for the official function, which is more convenient for management (such as opening and closing different types of files and temporarily closing them)

@jinzhongjia
Copy link
Author

image

just like this

@jinzhongjia
Copy link
Author

I think these are enough for testing without the need to install additional plugins

@hankertrix
Copy link
Contributor

I want to test this but couldn't figure out how to enable the inlay hints....

@uloco Neovim stable has updated to 0.10.0 and inlay hints should be easily testable now.

@uloco uloco linked a pull request Jun 5, 2024 that will close this issue
@uloco uloco closed this as completed in #77 Jun 5, 2024
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 a pull request may close this issue.

3 participants