Skip to content

Commit

Permalink
dump buffer at end
Browse files Browse the repository at this point in the history
  • Loading branch information
gptlang committed Feb 5, 2024
1 parent 081b4d3 commit 4c4fb86
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions rplugin/python3/handlers/chat_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,22 @@ def _add_chat_messages(
last_line_col,
[tok.encode("utf-8") for tok in token.split()],
)
if buffer:
self.nvim.exec_lua(
'require("CopilotChat.utils").log_info(...)', f"Buffer: {buffer}"
)
buffer_lines = cast(list[str], self.buffer.lines())
last_line_row = len(buffer_lines) - 1
last_line_col = len(buffer_lines[-1])

self.nvim.api.buf_set_text(
self.buffer.number,
last_line_row,
last_line_col,
last_line_row,
last_line_col,
[tok.encode("utf-8") for tok in buffer.split()],
)

def _add_end_separator(self, model: str, no_annoyance: bool = False):
current_datetime = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
Expand Down

0 comments on commit 4c4fb86

Please sign in to comment.