🐛 temp fix for highlighting in .ipynb

This commit is contained in:
Nate Sesti 2023-11-23 13:39:50 -07:00
parent 00fd0408d9
commit ff481ae229

View file

@ -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: