Skip to content

Commit

Permalink
chore: Update public API
Browse files Browse the repository at this point in the history
  • Loading branch information
dr1rrb committed Sep 20, 2024
1 parent 2cd7ad4 commit 613e64b
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ public record struct UpdateResult(
/// <param name="WaitForHotReload">Indicates if we should also wait for the change to be applied in the application before completing the resulting task.</param>
public record struct UpdateRequest(
string FilePath,
string OldText,
string NewText,
string? OldText,
string? NewText,
bool WaitForHotReload = true)
{
/// <summary>
Expand Down Expand Up @@ -82,7 +82,7 @@ public UpdateRequest Undo(bool waitForHotReload)
=> this with { OldText = NewText, NewText = OldText, WaitForHotReload = waitForHotReload };
}

public Task UpdateFileAsync(string filePath, string oldText, string newText, bool waitForHotReload, CancellationToken ct)
public Task UpdateFileAsync(string filePath, string? oldText, string newText, bool waitForHotReload, CancellationToken ct)
=> UpdateFileAsync(new UpdateRequest(filePath, oldText, newText, waitForHotReload), ct);

public async Task UpdateFileAsync(UpdateRequest req, CancellationToken ct)
Expand All @@ -93,7 +93,7 @@ public async Task UpdateFileAsync(UpdateRequest req, CancellationToken ct)
}
}

public Task TryUpdateFileAsync(string filePath, string oldText, string newText, bool waitForHotReload, CancellationToken ct)
public Task TryUpdateFileAsync(string filePath, string? oldText, string newText, bool waitForHotReload, CancellationToken ct)
=> TryUpdateFileAsync(new UpdateRequest(filePath, oldText, newText, waitForHotReload), ct);

public async Task<UpdateResult> TryUpdateFileAsync(UpdateRequest req, CancellationToken ct)
Expand All @@ -111,7 +111,7 @@ public async Task<UpdateResult> TryUpdateFileAsync(UpdateRequest req, Cancellati
var debug = log.IsDebugEnabled(LogLevel.Debug) ? log : default;
var tag = $"[{Interlocked.Increment(ref _reqId):D2}-{Path.GetFileName(req.FilePath)}]";

debug?.Debug($"{tag} Updating file {req.FilePath} (from: {req.OldText[..100]} | to: {req.NewText[..100]}.");
debug?.Debug($"{tag} Updating file {req.FilePath} (from: {req.OldText?[..100]} | to: {req.NewText?[..100]}.");

// As the local HR is not really ID trackable (trigger by VS without any ID), we capture the current ID here to make sure that if HR completes locally before we get info from the server, we won't miss it.
var currentLocalHrId = GetCurrentLocalHotReloadId();
Expand Down

0 comments on commit 613e64b

Please sign in to comment.