Skip to content

Conversation

@krrish175-byte
Copy link

Closing issue

closes #4029


val shouldBuildTestScope = options.shared.scope.test.getOrElse(false)
if (options.watch.watchMode) {
var isFirstRun = true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var isFirstRun = true
val isFirstRun = new AtomicBoolean(true)

Could be considered a nitpick, but this feels more future-proof.

Copy link
Contributor

@Gedochao Gedochao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contributing! I left some comments.
As noted above, we need tests for this.
Also, make sure to regenerate reference docs, since you're adding a new command line option. Refer to https://github.com/VirtusLab/scala-cli/blob/main/CONTRIBUTING.md#rules-for-a-well-formed-pr

val withTestScope = options.shared.scope.test.getOrElse(false)
if options.watch.watchMode then {
var expectedModifyEpochSecondOpt = Option.empty[Long]
var isFirstRun = true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var isFirstRun = true
val isFirstRun = new AtomicBoolean(true)

}
}
else if (options.sharedRepl.watch.watchMode) {
var isFirstRun = true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var isFirstRun = true
val isFirstRun = new AtomicBoolean(true)

*/
val mainThreadOpt = AtomicReference(Option.empty[Thread])

var isFirstRun = true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var isFirstRun = true
val isFirstRun = new AtomicBoolean(true)

restart: Boolean = false
restart: Boolean = false,
@Group(HelpGroup.Watch.toString)
@HelpMessage("Clear the screen each time the watch mode detects changes and re-compiles or re-runs")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@HelpMessage("Clear the screen each time the watch mode detects changes and re-compiles or re-runs")
@HelpMessage("Clear the screen each time watch mode detects changes and re-compiles or re-runs")

@Group(HelpGroup.Watch.toString)
@HelpMessage("Clear the screen each time the watch mode detects changes and re-compiles or re-runs")
@Tag(tags.implementation)
@Name("watch-cls")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@Name("watch-cls")
@Name("watchCls")
@Name("watchClear")

@krrish175-byte
Copy link
Author

@Gedochao
Thanks, I implemented the requested changes: replaced isFirstRun vars with AtomicBoolean, added watchCls / watchClear aliases in SharedWatchOptions.scala, added integration tests for --watch-clear-screen (Run/Compile/Package/Test/Repl/Publish), and regenerated the reference docs. Ready for another review, anything else you'd like adjusted?

@Gedochao
Copy link
Contributor

Gedochao commented Jan 4, 2026

@krrish175-byte I'll try to take a look and review in the next couple of days, but I can already see it's failing formatting (need to run scalafmt; once again sending back to the contributing guide for all that stuff)

@krrish175-byte krrish175-byte force-pushed the feat/watch-clear-screen branch from c461b0d to f8e80db Compare January 4, 2026 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clear screen on watch

2 participants