Skip to content

Commit ff5e8dc

Browse files
indutnysaghul
authored andcommitted
Fix repl autocompletion for regexp with flags
Fix: #74
1 parent 463df3a commit ff5e8dc

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

repl.js

+3
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,9 @@ import * as os from "os";
583583
base = get_context_word(line, pos);
584584
if (["true", "false", "null", "this"].includes(base) || !isNaN(+base))
585585
return eval(base);
586+
// Check if `base` is a set of regexp flags
587+
if (pos - base.length >= 3 && line[pos - base.length - 1] === '/')
588+
return new RegExp('', base);
586589
obj = get_context_object(line, pos - base.length);
587590
if (obj === null || obj === void 0)
588591
return obj;

0 commit comments

Comments
 (0)