From ff481ae2291af04540774972070399d640558907 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Thu, 23 Nov 2023 13:39:50 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20temp=20fix=20for=20highlighting?= =?UTF-8?q?=20in=20.ipynb?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugins/context_providers/highlighted_code.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/server/continuedev/plugins/context_providers/highlighted_code.py b/server/continuedev/plugins/context_providers/highlighted_code.py index 583c7fd90..8f0bac9be 100644 --- a/server/continuedev/plugins/context_providers/highlighted_code.py +++ b/server/continuedev/plugins/context_providers/highlighted_code.py @@ -84,7 +84,13 @@ class HighlightedCodeContextProvider(ContextProvider): filepath=item.description.description, range=Range.from_shorthand(int(lines[0]) - 1, 0, int(lines[1]), 0), ) - contents = await ide.readRangeInFile(rif) + # Temporary fix because reading the range in the file returns the raw JSON of the notebook + # , but we have the actual contents from when it was originally highlighted + if item.description.description.endswith(".ipynb"): + contents = item.content + else: + contents = await ide.readRangeInFile(rif) + return rif.with_contents(contents) async def get_chat_message(self, item: ContextItem) -> ChatMessage: