From dc12b61d9d40abb1e5d474e4dcf68e05adc9cb09 Mon Sep 17 00:00:00 2001 From: KenyC Date: Sun, 18 Jun 2023 20:10:20 +0200 Subject: [PATCH] Escape dollar signs in completions returned by kernel: avoids erroneous completions in R --- lib/kernel.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/kernel.py b/lib/kernel.py index d44b394..ed3a53b 100644 --- a/lib/kernel.py +++ b/lib/kernel.py @@ -44,6 +44,7 @@ HELIUM_OBJECT_INSPECT_PANEL = "helium_object_inspect" ANSI_ESCAPE_PATTERN = re.compile(r"\x1b[^m]*m") +DOLLAR_REGEX = re.compile(r"(?" if match["type"] is None else match["type"] ), - match["text"], + escape_dollar_signs(match["text"]), ) for match in recv_content["metadata"]["_jupyter_types_experimental"] ] else: # Just say the completion is came from this plugin, otherwise. return [ - (match + "\tHelium", match) for match in recv_content["matches"] + (match + "\tHelium", escape_dollar_signs(match)) for match in recv_content["matches"] ] except Empty: self._logger.info("Completion timeout.")