Skip to content
This repository has been archived by the owner on Feb 5, 2024. It is now read-only.

Commit

Permalink
feat: show chat in markdown format
Browse files Browse the repository at this point in the history
  • Loading branch information
jellydn committed Dec 20, 2023
1 parent 9b19d51 commit 9c14152
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions rplugin/python3/plugin.py
Expand Up @@ -47,8 +47,16 @@ def copilotChat(self, args: list[str]):
# Set filetype as markdown and wrap
self.nvim.command("setlocal filetype=markdown")
self.nvim.command("setlocal wrap")

if self.nvim.current.line != "":
self.nvim.command("normal o")
self.nvim.current.line += "### User"
self.nvim.command("normal o")
self.nvim.current.line += prompt
self.nvim.command("normal o")
self.nvim.current.line += "### Copilot"
self.nvim.command("normal o")

for token in self.copilot.ask(prompt, code, language=file_type):
if "\n" not in token:
self.nvim.current.line += token
Expand All @@ -58,3 +66,6 @@ def copilotChat(self, args: list[str]):
self.nvim.current.line += lines[i]
if i != len(lines) - 1:
self.nvim.command("normal o")

self.nvim.command("normal o")
self.nvim.current.line += "--- End of chat ---"

0 comments on commit 9c14152

Please sign in to comment.