Skip to content

Commit

Permalink
feat: make several highlights configurable (#416)
Browse files Browse the repository at this point in the history
* Make settings params value highlight configurable

* Make input widget title highlight configurable

* Use Identifier instead of @Identifier

* Make active session highlight configurable

* Fix stylua check

* Make code edit result title configurable
  • Loading branch information
petobens authored Jun 22, 2024
1 parent a254f6c commit 4cf2bf6
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 5 deletions.
12 changes: 10 additions & 2 deletions lua/chatgpt/code_edits.lua
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,11 @@ end
local spinner = Spinner:new(function(state)
vim.schedule(function()
if input_window.bufnr ~= nil then
output_window.border:set_text("top", " " .. state .. " ", "center")
output_window.border:set_text(
"top",
{ { " " .. state .. " ", Config.options.highlights.code_edit_result_title } },
"center"
)
end
display_input_suffix(state)
end)
Expand All @@ -108,7 +112,11 @@ local hide_progress = function()
display_input_suffix()

if output_window.bufnr ~= nil then
output_window.border:set_text("top", " Result ", "center")
output_window.border:set_text(
"top",
{ { " Result ", Config.options.highlights.code_edit_result_title } },
"center"
)
end
end

Expand Down
2 changes: 1 addition & 1 deletion lua/chatgpt/common/input_widget.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ return function(name, on_submit)
border = {
style = "rounded",
text = {
top = " " .. name .. " ",
top = { { " " .. name .. " ",Config.options.highlights.input_title } },
top_align = "center",
},
},
Expand Down
4 changes: 4 additions & 0 deletions lua/chatgpt/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,10 @@ function M.defaults()
highlights = {
help_key = "@symbol",
help_description = "@comment",
params_value = "Identifier",
input_title = "FloatBorder",
active_session = "ErrorMsg",
code_edit_result_title = "FloatBorder",
},
}
return defaults
Expand Down
2 changes: 1 addition & 1 deletion lua/chatgpt/flows/chat/sessions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ M.render_list = function()
for i, session in pairs(M.sessions) do
local icon = i == M.active_line and Config.options.chat.sessions_window.active_sign
or Config.options.chat.sessions_window.inactive_sign
local cls = i == M.active_line and "ErrorMsg" or "Comment"
local cls = i == M.active_line and Config.options.highlights.active_session or "Comment"
local name = Utils.trimText(session.name, 30)
local vt = {
{ (M.current_line == i and Config.options.chat.sessions_window.current_line_sign or " ") .. icon .. name, cls },
Expand Down
2 changes: 1 addition & 1 deletion lua/chatgpt/settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ M.get_settings_panel = function(type, default_params)
if M.params[key] ~= nil then
local vt = {
{ Config.options.settings_window.setting_sign .. key .. ": ", "ErrorMsg" },
{ M.params[key] .. "", "Identifier" },
{ M.params[key] .. "", Config.options.highlights.params_value },
}
table.insert(details, vt)
end
Expand Down

0 comments on commit 4cf2bf6

Please sign in to comment.