summaryrefslogtreecommitdiff
path: root/cli/tools/jupyter/server.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tools/jupyter/server.rs')
-rw-r--r--cli/tools/jupyter/server.rs14
1 files changed, 12 insertions, 2 deletions
diff --git a/cli/tools/jupyter/server.rs b/cli/tools/jupyter/server.rs
index 0cd80f7dd..5680ed4c1 100644
--- a/cli/tools/jupyter/server.rs
+++ b/cli/tools/jupyter/server.rs
@@ -329,7 +329,12 @@ impl JupyterServer {
})
.collect();
- (candidates, cursor_pos - prop_name.len())
+ if prop_name.len() > cursor_pos {
+ // TODO(bartlomieju): most likely not correct, but better than panicking because of sub with overflow
+ (candidates, cursor_pos)
+ } else {
+ (candidates, cursor_pos - prop_name.len())
+ }
} else {
// combine results of declarations and globalThis properties
let mut candidates = get_expression_property_names(
@@ -349,7 +354,12 @@ impl JupyterServer {
candidates.sort();
candidates.dedup(); // make sure to sort first
- (candidates, cursor_pos - expr.len())
+ if expr.len() > cursor_pos {
+ // TODO(bartlomieju): most likely not correct, but better than panicking because of sub with overflow
+ (candidates, cursor_pos)
+ } else {
+ (candidates, cursor_pos - expr.len())
+ }
};
connection