Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions rplugin/python3/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,16 @@ def copilotChat(self, args: list[str]):
prompt = prompts.EXPLAIN_SHORTCUT

# Get code from the unnamed register
code = self.nvim.eval("getreg('\"')")
code = self.nvim.current.buffer[:]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this pass the whole file in the buffer in or just the visible part?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The whole file which is opened currently

file_type = self.nvim.eval("expand('%')").split(".")[-1]
# Check if we're already in a chat buffer
if self.nvim.eval("getbufvar(bufnr(), '&buftype')") != "nofile":
# Create a new scratch buffer to hold the chat
self.nvim.command("enew")
self.nvim.command("vnew")
# Set it to the left side of the screen
self.nvim.command("wincmd L")
self.nvim.command("vertical resize 50%")
# Set the buffer type to nofile and hide it when it's not active
self.nvim.command("setlocal buftype=nofile bufhidden=hide noswapfile")
# Set filetype as markdown and wrap with linebreaks
self.nvim.command("setlocal filetype=markdown wrap linebreak")
Expand Down