Open chrisgrieser opened 4 weeks ago
Is this the expected behaviour @chrisgrieser?
[!WARNING] Flashbang start 👍🏼
My current config (using lazy.nvim)
-- path/to/plugins/supermaven.lua
return {
"supermaven-inc/supermaven-nvim",
lazy = false,
config = function()
require("supermaven-nvim").setup({
keymaps = {
accept_suggestion = "<S-Tab>",
},
color = {
suggestion_color = "#DC8CE2",
cterm = 117,
},
})
end,
}
Not sure what you mean, but from the config in your video, I actually figured out that the respective highlight group is exported and can therefore be configured via this:
require("supermaven-nvim.completion_preview").suggestion_group
So for me personally, this solves it, though nonetheless it would be more user-friendly, if the highlight group could be customizable directly in the settings.
What I meant is that with the config I am using it detects the color I changed it to be even when changing from a dark colorscheme to a light one.
My question would be, if what you want is to persist the same color for both dark and light or change them depending on the colorscheme.
From what I am understanding is that you want for example the ghost text to be link to for example the group Comment
and take the coloscheme's color for Comment
.
If that is the case I think of 2 simple solutions.
suggestion_group
in the config settings.Exposing suggestion_group
is what I meant to suggest. It's also the method most plugins use when configuring their appearance.
@chrisgrieser I made the changes in #51, tell your thoughts about it and test it if you want.
@AlejandroSuero thanks for the implementation!
There seems to be an issue that initially, supermaven uses the wrong color, a problem that does not occur when I use require("supermaven-nvim.completion_preview").suggestion_group = "NonText"
.
I think when supermaven is loaded after the colorscheme is set, the callback here is never called. However, when loading the colorscheme after supermaven has been loaded, the correct color is displayed. I think running the callback function once on manually on initialization might solve this already.
@chrisgrieser I logged out the callback with:
print("setting suggestion group")
print(config.color.suggestion_group)
Here are the results:
Is getting called in every VimEnter
event or ColorScheme
event.
When logging out the event I get the following:
setting suggestion group NonText
event {
buf = 1,
event = "ColorScheme",
file = "",
group = 18,
id = 46,
match = "astrodark"
}
setting suggestion group NonText
event {
buf = 1,
event = "VimEnter",
file = "",
group = 18,
id = 46,
match = ""
}
Every time the colorscheme is change it will call the callback function with the event.event = "ColorScheme"
.
@chrisgrieser if I change my plugin to load on event = "VeryLazy"
it won't be called unless I change the colorscheme. Maybe this is what you are experiencing.
I am going to ask in the PR itself if I should change it so it can be load with that behaviour in mind or create another PR with those changes.
Currently, we can customize the color of the ghost text suggestions via
color
in the setup call. (which, btw, is not working for me.) However, that is quite inflexible. For instance, I switch between two themes (light/dark mode), and one color that works in light mode does not work well in dark mode.A solution for this would be to simply let users link a Highlight group that the suggestions should use. That way, the appearance of the suggestions should follow whatever theme the user switches to. It's also what other plugins commonly do to solve that problem.