Skip to content

Commit

Permalink
fix: enable vim diagnostics after finish the conversation
Browse files Browse the repository at this point in the history
Closed #72
  • Loading branch information
jellydn committed Feb 23, 2024
1 parent 7ac1f34 commit a0a5a2a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 6 additions & 0 deletions rplugin/python3/CopilotChat/handlers/chat_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ def chat(
disable_end_separator: bool = False,
model: str = "gpt-4",
):
"""Disable vim diagnostics on the chat buffer"""
self.nvim.command(":lua vim.diagnostic.disable()")

disable_separators = (
self.nvim.eval("g:copilot_chat_disable_separators") == "yes"
)
Expand Down Expand Up @@ -330,6 +333,9 @@ def _add_chat_messages(
'require("CopilotChat.utils").log_info(...)', "Copilot answered"
)

""" Enable vim diagnostics on the chat buffer after the chat is complete """
self.nvim.command(":lua vim.diagnostic.enable()")

def _add_end_separator(self, model: str, disable_separators: bool = False):
current_datetime = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
model_info = f"\n#### Answer provided by Copilot (Model: `{model}`) on {current_datetime}."
Expand Down
3 changes: 0 additions & 3 deletions rplugin/python3/CopilotChat/handlers/vsplit_chat_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ def vsplit(self):
)
self.nvim.current.window.vars[var_key] = True

""" Disable vim diagnostics on the chat buffer """
self.nvim.command(":lua vim.diagnostic.disable()")

def toggle_vsplit(self):
"""Toggle vsplit chat window."""
var_key = "copilot_chat"
Expand Down

0 comments on commit a0a5a2a

Please sign in to comment.