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?

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