forked from CopilotC-Nvim/CopilotChat.nvim
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvsplit_chat_handler.py
More file actions
38 lines (33 loc) · 1.11 KB
/
vsplit_chat_handler.py
File metadata and controls
38 lines (33 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from CopilotChat.handlers.chat_handler import ChatHandler
from CopilotChat.mypynvim.core.buffer import MyBuffer
from CopilotChat.mypynvim.core.nvim import MyNvim
class VSplitChatHandler(ChatHandler):
def __init__(self, nvim: MyNvim):
self.nvim: MyNvim = nvim
self.copilot = None
self.buffer: MyBuffer = MyBuffer.new(
self.nvim,
{
"filetype": "markdown",
},
)
def vsplit(self):
var_key = "copilot_chat"
for window in self.nvim.windows:
try:
if window.vars[var_key]:
self.nvim.current.window = window
return
except Exception:
pass
self.buffer.vsplit(
{
"wrap": True,
"linebreak": True,
"conceallevel": 2,
"concealcursor": "n",
}
)
self.nvim.current.window.vars[var_key] = True
def chat(self, prompt: str, filetype: str, code: str = ""):
super().chat(prompt, filetype, code, self.nvim.current.window.handle)