From 7eef4d7acdcfa07348f2fe45a1e255817db7f522 Mon Sep 17 00:00:00 2001 From: Xuguang Mei Date: Tue, 28 Feb 2023 18:26:16 +0800 Subject: [PATCH] Change noCompletion to showCompletion Co-authored-by: Ruben Bridgewater --- lib/internal/repl/utils.js | 6 ++++-- lib/repl.js | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/internal/repl/utils.js b/lib/internal/repl/utils.js index e5bd406544fccd..c52b888ab58bed 100644 --- a/lib/internal/repl/utils.js +++ b/lib/internal/repl/utils.js @@ -365,7 +365,7 @@ function setupPreview(repl, contextSymbol, bufferSymbol, active) { }, () => callback(new ERR_INSPECTOR_NOT_AVAILABLE())); } - const showPreview = (noCompletion = false) => { + const showPreview = (showCompletion = true) => { // Prevent duplicated previews after a refresh. if (inputPreview !== null || !repl.isCompletionEnabled) { return; @@ -382,7 +382,9 @@ function setupPreview(repl, contextSymbol, bufferSymbol, active) { // Add the autocompletion preview. const insertPreview = false; - !noCompletion && showCompletionPreview(repl.line, insertPreview); + if (showCompletion) { + showCompletionPreview(repl.line, insertPreview); + } // Do not preview if the command is buffered. if (repl[bufferSymbol]) { diff --git a/lib/repl.js b/lib/repl.js index 0ef3f7835882bc..500770ddcd075b 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -993,7 +993,8 @@ function REPLServer(prompt, clearPreview(key); if (!reverseSearch(d, key)) { ttyWrite(d, key); - showPreview(key.name === 'escape'); + const showCompletionPreview = key.name !== 'escape'; + showPreview(showCompletionPreview); } return; }