Skip to content

Commit 62a91c3

Browse files
authored
refactor(ui): improve chat and overlay function signatures (#1400)
- Remove unnecessary visibility check in Chat:remove_message - Add @Protected annotation to Chat:parse for clarity - Make Overlay:show_help pos parameter optional for flexibility These changes enhance code readability and maintainability by refining function signatures and documentation.
1 parent f2f523f commit 62a91c3

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

lua/CopilotChat/ui/chat.lua

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -516,11 +516,8 @@ end
516516
---@param role string? If specified, only considers sections of the given role
517517
---@param cursor boolean? If true, removes the message closest to the cursor position
518518
function Chat:remove_message(role, cursor)
519-
if not self:visible() then
520-
return
521-
end
522-
523519
self:parse()
520+
524521
local message = self:get_message(role, cursor)
525522
if not message then
526523
return
@@ -615,6 +612,8 @@ function Chat:validate()
615612
end
616613
end
617614

615+
--- Parse the chat window buffer into structured messages.
616+
---@protected
618617
function Chat:parse()
619618
self:validate()
620619

lua/CopilotChat/ui/overlay.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ end
130130

131131
--- Show help message in the overlay
132132
---@param msg string?
133-
---@param pos number
133+
---@param pos number?
134134
---@protected
135135
function Overlay:show_help(msg, pos)
136136
if not msg or msg == '' then

0 commit comments

Comments
 (0)