Skip to content
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

Improve console output of dotnet watch ⌚ #23318

Merged
merged 11 commits into from
Jan 12, 2022

Conversation

TanayParikh
Copy link
Contributor

  • Add emojis ( πŸ”₯ , ⌚, πŸ”§ , etc.)
  • Improved formatting, feedback for prompts.
  • Relative file paths are now shown in the file changed dialog instead of absolute paths
Screen.Recording.2022-01-07.at.9.50.25.AM.mov
Text output
dotnet watch πŸ”₯ Hot reload enabled. For a list of supported edits, see https://aka.ms/dotnet/hot-reload. 
  πŸ’‘ Press "Ctrl + R" to restart.
dotnet watch πŸ”§ Building...
  Determining projects to restore...
  All projects are up-to-date for restore.
  blazorserver -> /workspaces/sdk/artifacts/bin/blazorserver/Debug/net6.0/blazorserver.dll
dotnet watch πŸš€ Started
info: Microsoft.Hosting.Lifetime[14]
      Now listening on: https://localhost:7203
dotnet watch ⌚ Unable to launch the browser. Navigate to https://localhost:7203
info: Microsoft.Hosting.Lifetime[14]
      Now listening on: http://localhost:5258
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
      Content root path: /workspaces/sdk/blazorserver/
dotnet watch ⌚ File changed: ./Pages/Counter2.razor.
dotnet watch πŸ”₯ Hot reload of changes succeeded.
dotnet watch ⌚ File changed: ./Pages/Counter2.razor.
dotnet watch ⌚ Unable to apply hot reload because of a rude edit.
  ❔ Do you want to restart your app - Yes (y) / No (n) / Always (a) / Never (v)?
  ❔ k
  ❔ Do you want to restart your app - Yes (y) / No (n) / Always (a) / Never (v)?
  ❔ l
  ❔ Do you want to restart your app - Yes (y) / No (n) / Always (a) / Never (v)?
  ❔ y

dotnet watch ⌚ Exited
dotnet watch πŸ”§ Building...
/workspaces/sdk/blazorserver/Pages/Counter.razor(27,1): error RZ10012: Found markup element with unexpected name 'Counter2'. If this is intended to be a component, add a @using directive for its namespace. [/workspaces/sdk/blazorserver/blazorserver.csproj]
dotnet watch ⌚ Waiting for a file to change before restarting dotnet...
dotnet watch πŸ”§ Building...
  blazorserver -> /workspaces/sdk/artifacts/bin/blazorserver/Debug/net6.0/blazorserver.dll
dotnet watch πŸš€ Started
info: Microsoft.Hosting.Lifetime[14]
      Now listening on: https://localhost:7203
info: Microsoft.Hosting.Lifetime[14]
      Now listening on: http://localhost:5258
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
      Content root path: /workspaces/sdk/blazorserver/
dotnet watch πŸ›‘ Shutdown requested. Press Ctrl+C again to force exit.
info: Microsoft.Hosting.Lifetime[0]
      Application is shutting down...

Fixes: dotnet/aspnetcore#35562

@TanayParikh TanayParikh added the Area-AspNetCore RazorSDK, BlazorWebAssemblySDK, dotnet-watch label Jan 7, 2022
@TanayParikh TanayParikh self-assigned this Jan 7, 2022
Comment on lines 20 to 26
("Hot reload", "πŸ”₯"),
("HotReload", "πŸ”₯"),
("Started", "πŸš€"),
("Restart", "πŸ”„"),
("Shutdown", "πŸ›‘"),
("Building...", "πŸ”§"),
("Error", "❌"),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Main emoji matching. Additional ones we may want to consider:

  • ✏️ for file(s) changed
  • ❌ for Unable to apply hot reload because of a rude edit. Note this would conflict with Error
  • βš’οΈ for build instead of πŸ”§
  • βž• / πŸ†• for when a new file is added

@TanayParikh TanayParikh requested a review from a team January 7, 2022 18:10
@@ -294,6 +299,13 @@ private static void ConfigureExecutable(DotNetWatchContext context, ProcessSpec
}
}

private string GetRelativeFilePath(string path)
{
return path.StartsWith(_workingDirectory) ?
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
return path.StartsWith(_workingDirectory) ?
return path.StartsWith(_workingDirectory, StringComparison.OrdinalIgnoreCase) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had considered this (because MacOS is case insensitive), however Linux is case sensitive and Windows is configurable. Going to use StringComparison.Ordinal to be safe.

src/BuiltInTools/dotnet-watch/HotReloadDotNetWatcher.cs Outdated Show resolved Hide resolved
src/BuiltInTools/dotnet-watch/Internal/ConsoleReporter.cs Outdated Show resolved Hide resolved
@KalleOlaviNiemitalo
Copy link

Maybe tmux can be hacked to translate those emojis to down-line-loaded characters if not natively supported by the terminal.

Copy link
Contributor

@pranavkm pranavkm left a comment

Choose a reason for hiding this comment

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

Thanks!

var dotnetWatchDefaultPrefix = "dotnet watch";

// stdout
reporter.Verbose("verbose", emoji: "πŸ˜„");
Copy link
Contributor

Choose a reason for hiding this comment

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

πŸ‘πŸ½

@TanayParikh TanayParikh enabled auto-merge (squash) January 11, 2022 22:16
@TanayParikh TanayParikh merged commit 5ae5131 into main Jan 12, 2022
@TanayParikh TanayParikh deleted the taparik/emojifyDotNetWatch branch January 12, 2022 02:25
TanayParikh added a commit that referenced this pull request Jan 12, 2022
* Requester

* Relative File Path

* Updated Rude Edit Dialog

* Emojify

* Tests

* Test fix 2 (ChangeExcludedFile still failing)

* Relative path robustness

* File changed test

* Arg based emojis

* Remove duplicate tip message

(cherry picked from commit 5ae5131)
TanayParikh added a commit that referenced this pull request Jan 25, 2022
…#23318) (#23400)

* Improve console output of `dotnet watch` ⌚ (#23318)

* UTF8->UTF8 with BOM & UTF8 Console Output Encoding

* DOTNET_WATCH_SUPPRESS_EMOJIS

* Set process encoding

* `dotnet watch` test fix search console history

(cherry picked from commit 4250693)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-AspNetCore RazorSDK, BlazorWebAssemblySDK, dotnet-watch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve console output of "dotnet watch" to make it clearer
3 participants