-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Added console clearing with a message to --watch starts #20427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added console clearing with a message to --watch starts #20427
Conversation
I advocated against immediately clearing the console when starting --watch in microsoft#17756 because it was confusing to have the console suddenly become blank, wait a while, and _then_ give output. After using the feature for a little while, I think it's a little disorienting how the console will only start clearing after the first recompile. This change clears the console and immediately prints a new "Starting compilation in watch mode..." message.
Build fixed by #20429, please rebase once that's in. |
@sheetalkamat can you please review this change, and merge |
@JoshuaKGoldberg some new CI failures after #20429. can you take a look. |
src/compiler/watch.ts
Outdated
@@ -302,6 +302,10 @@ namespace ts { | |||
// There is no extra check needed since we can just rely on the program to decide emit | |||
const builder = createBuilder({ getCanonicalFileName, computeHash }); | |||
|
|||
if (watchingHost.system.clearScreen) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you create function expression clearScreen when entering this function and use that instead of if checks here and in update program?
const clearScreen = watchingHost.system.clearScreen ? watchingHost.system.clearScreen.bind(watchingHost.system) : noop;
# Conflicts: # src/harness/unittests/tscWatchMode.ts
Is it possible to still have the old behavior behind the flag? |
Followup to #20379.
I advocated against immediately clearing the console when starting --watch in #17756 because it was confusing to have the console suddenly become blank, wait a while, and then give output. After using the feature for a little while, I think it's a little disorienting how the console will only start clearing after the first recompile. This change clears the console and immediately prints a new "Starting compilation in watch mode..." message.