File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -207,6 +207,7 @@ export function createRepl(options: CreateReplOptions = {}) {
207
207
state,
208
208
input : code ,
209
209
context,
210
+ overrideIsCompletion : false ,
210
211
} ) ;
211
212
assert ( result . containsTopLevelAwait === false ) ;
212
213
return result . value ;
@@ -512,13 +513,20 @@ function appendCompileAndEvalInput(options: {
512
513
/** Enable top-level await but only if the TSNode service allows it. */
513
514
enableTopLevelAwait ?: boolean ;
514
515
context : Context | undefined ;
516
+ /**
517
+ * Added so that `evalCode` can be guaranteed *not* to trigger the `isCompletion`
518
+ * codepath. However, the `isCompletion` logic is ancient and maybe should be removed entirely.
519
+ * Nobody's looked at it in a long time.
520
+ */
521
+ overrideIsCompletion ?: boolean ;
515
522
} ) : AppendCompileAndEvalInputResult {
516
523
const {
517
524
service,
518
525
state,
519
526
wrappedErr,
520
527
enableTopLevelAwait = false ,
521
528
context,
529
+ overrideIsCompletion,
522
530
} = options ;
523
531
let { input } = options ;
524
532
@@ -533,7 +541,7 @@ function appendCompileAndEvalInput(options: {
533
541
}
534
542
535
543
const lines = state . lines ;
536
- const isCompletion = ! / \n $ / . test ( input ) ;
544
+ const isCompletion = overrideIsCompletion ?? ! / \n $ / . test ( input ) ;
537
545
const undo = appendToEvalState ( state , input ) ;
538
546
let output : string ;
539
547
You can’t perform that action at this time.
0 commit comments