summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTy Dunn <ty@tydunn.com>2023-06-15 15:49:35 -0700
committerTy Dunn <ty@tydunn.com>2023-06-15 15:49:35 -0700
commitcfd5227274048a372d134aa8d1f1826a0d3d8fff (patch)
treef37301135f4cf1edac13b4bb6d94c2f8c2437bbe
parent73c3af02845a9e76c36c8ec7ff0112fb020759e9 (diff)
downloadsncontinue-cfd5227274048a372d134aa8d1f1826a0d3d8fff.tar.gz
sncontinue-cfd5227274048a372d134aa8d1f1826a0d3d8fff.tar.bz2
sncontinue-cfd5227274048a372d134aa8d1f1826a0d3d8fff.zip
get full contents of open file for explain
-rw-r--r--continuedev/src/continuedev/core/sdk.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/continuedev/src/continuedev/core/sdk.py b/continuedev/src/continuedev/core/sdk.py
index b806ef73..76f72d01 100644
--- a/continuedev/src/continuedev/core/sdk.py
+++ b/continuedev/src/continuedev/core/sdk.py
@@ -172,6 +172,15 @@ class ContinueSDK(AbstractContinueSDK):
async def get_chat_context(self) -> List[ChatMessage]:
history_context = self.history.to_chat_history()
highlighted_code = await self.ide.getHighlightedCode()
+ if len(highlighted_code) == 0:
+ # Get the full contents of all open files
+ files = await self.ide.getOpenFiles()
+ contents = {}
+ for file in files:
+ contents[file] = await self.ide.readFile(file)
+
+ highlighted_code = [RangeInFile.from_entire_file(
+ filepath, content) for filepath, content in contents.items()]
for rif in highlighted_code:
code = await self.ide.readRangeInFile(rif)
history_context.append(ChatMessage(