Skip to content

Commit

Permalink
Fix repl autocompletion for regexp with flags
Browse files Browse the repository at this point in the history
  • Loading branch information
indutny authored and saghul committed Nov 24, 2023
1 parent 463df3a commit ff5e8dc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,9 @@ import * as os from "os";
base = get_context_word(line, pos);
if (["true", "false", "null", "this"].includes(base) || !isNaN(+base))
return eval(base);
// Check if `base` is a set of regexp flags
if (pos - base.length >= 3 && line[pos - base.length - 1] === '/')
return new RegExp('', base);
obj = get_context_object(line, pos - base.length);
if (obj === null || obj === void 0)
return obj;
Expand Down

0 comments on commit ff5e8dc

Please sign in to comment.