Skip to content
76 changes: 38 additions & 38 deletions QuickShell.Core/Abstractions/IQuickShellEventSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,56 +7,56 @@ namespace QuickShell.Abstractions;
internal interface IQuickShellEventSource
{
/// <summary>
/// Determines whether diagnostic event writing is enabled.
/// </summary>
/// <returns><c>true</c> if diagnostic event writing is enabled; otherwise, <c>false</c>.</returns>
bool IsEnabled();
/// Determines whether diagnostic event writing is enabled.
/// </summary>
/// <returns><c>true</c> if diagnostic event writing is enabled; otherwise, <c>false</c>.</returns>
bool IsEnabled();

/// <summary>
/// Emits a diagnostic event for row-cache activity.
/// </summary>
/// <param name="kind">The kind of row-cache activity.</param>
void WriteRowCache(string kind);
/// Emits a diagnostic event for row-cache activity.
/// </summary>
/// <param name="kind">The kind of row-cache activity.</param>
void WriteRowCache(string kind);

/// <summary>
/// Emits a diagnostic event for plan-cache activity.
/// </summary>
/// <param name="kind">The type of plan-cache activity.</param>
void WritePlanCache(string kind);
/// Emits a diagnostic event for plan-cache activity.
/// </summary>
/// <param name="kind">The type of plan-cache activity.</param>
void WritePlanCache(string kind);

/// <summary>
/// Records the duration of a startup operation.
/// </summary>
/// <param name="name">The name identifying the startup operation.</param>
/// <param name="elapsedMs">The operation duration in milliseconds.</param>
void WriteStartupSpan(string name, double elapsedMs);
/// Records the duration of a startup operation.
/// </summary>
/// <param name="name">The name identifying the startup operation.</param>
/// <param name="elapsedMs">The operation duration in milliseconds.</param>
void WriteStartupSpan(string name, double elapsedMs);

/// <summary>
/// Records a repository-related diagnostic event.
/// </summary>
/// <param name="location">The repository location associated with the event.</param>
/// <param name="eventName">The name of the repository event.</param>
/// <param name="elapsedMs">
/// The optional elapsed time in milliseconds. A <see langword="null"/> value is recorded as
/// <c>-1</c>, meaning the duration is unavailable rather than a real measured latency.
/// </param>
void WriteRepository(string location, string eventName, long? elapsedMs = null);
/// Records a repository-related diagnostic event.
/// </summary>
/// <param name="location">The repository location associated with the event.</param>
/// <param name="eventName">The name of the repository event.</param>
/// <param name="elapsedMs">
/// The optional elapsed time in milliseconds. A <see langword="null"/> value is recorded as
/// <c>-1</c>, meaning the duration is unavailable rather than a real measured latency.
/// </param>
void WriteRepository(string location, string eventName, long? elapsedMs = null);

/// <summary>
/// Emits a support diagnostic event identified by an event code.
/// </summary>
/// <param name="eventCode">The identifier for the support diagnostic event.</param>
void WriteSupportEvent(string eventCode);
/// Emits a support diagnostic event identified by an event code.
/// </summary>
/// <param name="eventCode">The identifier for the support diagnostic event.</param>
void WriteSupportEvent(string eventCode);

/// <summary>
/// Records a diagnostic event for a failure to write support diagnostics.
/// </summary>
/// <param name="exceptionType">The type of exception that caused the write failure.</param>
void WriteSupportWriteFailure(string exceptionType);
/// Records a diagnostic event for a failure to write support diagnostics.
/// </summary>
/// <param name="exceptionType">The type of exception that caused the write failure.</param>
void WriteSupportWriteFailure(string exceptionType);

/// <summary>
/// Records the completion of Git repository discovery.
/// </summary>
/// <param name="repoCount">The number of repositories discovered.</param>
void WriteGitDiscoveryComplete(int repoCount);
/// Records the completion of Git repository discovery.
/// </summary>
/// <param name="repoCount">The number of repositories discovered.</param>
void WriteGitDiscoveryComplete(int repoCount);
}
12 changes: 6 additions & 6 deletions QuickShell.Core/Classification/ProjectAnalysisService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,12 @@ public string BuildTaskTypeChoicesJson(
}

/// <summary>
/// Suggests a companion app for the specified project directory.
/// </summary>
/// <param name="directory">The project directory to inspect.</param>
/// <returns>A companion app suggestion, or null when no suggestion is available.</returns>
public CompanionAppSuggestion? TrySuggestCompanionApp(string directory) =>
_companionAppDetector.TrySuggest(directory);
/// Suggests a companion app for the specified project directory.
/// </summary>
/// <param name="directory">The project directory to inspect.</param>
/// <returns>A companion app suggestion, or null when no suggestion is available.</returns>
public CompanionAppSuggestion? TrySuggestCompanionApp(string directory) =>
_companionAppDetector.TrySuggest(directory);

public string? TryDetectDevServerUrl(string directory) =>
_devServerDetector.TryDetectDevServerUrl(directory);
Expand Down
68 changes: 34 additions & 34 deletions QuickShell.Core/Interop/ShellFileDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -364,17 +364,17 @@ internal partial interface IModalWindow
internal partial interface IFileDialog : IModalWindow
{
/// <summary>
/// Configures the file types displayed by the dialog.
/// </summary>
/// <param name="cFileTypes">The number of file type specifications.</param>
/// <param name="rgFilterSpec">A pointer to the array of file type specifications.</param>
void SetFileTypes(uint cFileTypes, nint rgFilterSpec);
/// Configures the file types displayed by the dialog.
/// </summary>
/// <param name="cFileTypes">The number of file type specifications.</param>
/// <param name="rgFilterSpec">A pointer to the array of file type specifications.</param>
void SetFileTypes(uint cFileTypes, nint rgFilterSpec);

/// <summary>
/// Selects the default file type in the dialog's file type list.
/// </summary>
/// <param name="iFileType">The one-based index of the file type to select.</param>
void SetFileTypeIndex(uint iFileType);
/// Selects the default file type in the dialog's file type list.
/// </summary>
/// <param name="iFileType">The one-based index of the file type to select.</param>
void SetFileTypeIndex(uint iFileType);

/// <summary>
/// Retrieves the index of the currently selected file type.
Expand All @@ -396,10 +396,10 @@ internal partial interface IFileDialog : IModalWindow
int Unadvise(uint dwCookie);

/// <summary>
/// Configures the file dialog options.
/// </summary>
/// <param name="fos">The bitwise combination of file dialog option flags.</param>
void SetOptions(uint fos);
/// Configures the file dialog options.
/// </summary>
/// <param name="fos">The bitwise combination of file dialog option flags.</param>
void SetOptions(uint fos);

/// <summary>
/// Retrieves the current options configured for the file dialog.
Expand All @@ -418,10 +418,10 @@ internal partial interface IFileDialog : IModalWindow
int SetDefaultFolder(nint psi);

/// <summary>
/// Sets the folder displayed by the file dialog.
/// </summary>
/// <param name="psi">The shell item representing the folder to display.</param>
void SetFolder(IShellItem psi);
/// Sets the folder displayed by the file dialog.
/// </summary>
/// <param name="psi">The shell item representing the folder to display.</param>
void SetFolder(IShellItem psi);

/// <summary>
/// Retrieves the dialog's current folder.
Expand All @@ -440,10 +440,10 @@ internal partial interface IFileDialog : IModalWindow
int GetCurrentSelection(out nint ppsi);

/// <summary>
/// Sets the file name displayed in the dialog.
/// </summary>
/// <param name="pszName">The file name to display.</param>
void SetFileName([MarshalAs(UnmanagedType.LPWStr)] string pszName);
/// Sets the file name displayed in the dialog.
/// </summary>
/// <param name="pszName">The file name to display.</param>
void SetFileName([MarshalAs(UnmanagedType.LPWStr)] string pszName);

/// <summary>
/// Retrieves the current file name displayed by the dialog.
Expand All @@ -454,9 +454,9 @@ internal partial interface IFileDialog : IModalWindow
int GetFileName(out nint pszName);

/// <summary>
/// Sets the dialog title.
/// </summary>
void SetTitle([MarshalAs(UnmanagedType.LPWStr)] string pszTitle);
/// Sets the dialog title.
/// </summary>
void SetTitle([MarshalAs(UnmanagedType.LPWStr)] string pszTitle);

/// <summary>
/// Sets the label of the dialog's OK button.
Expand All @@ -475,11 +475,11 @@ internal partial interface IFileDialog : IModalWindow
int SetFileNameLabel(nint pszLabel);

/// <summary>
/// Retrieves the selected shell item.
/// </summary>
/// <param name="ppsi">Receives a pointer to the selected shell item.</param>
///
void GetResult(out nint ppsi);
/// Retrieves the selected shell item.
/// </summary>
/// <param name="ppsi">Receives a pointer to the selected shell item.</param>
///
void GetResult(out nint ppsi);

/// <summary>
/// Adds a location to the dialog's navigation pane.
Expand Down Expand Up @@ -611,11 +611,11 @@ internal partial interface IShellItem
int GetParent(out nint ppsi);

/// <summary>
/// Retrieves the item's display name in the specified format.
/// </summary>
/// <param name="sigdnName">The display name format to retrieve.</param>
/// <param name="ppszName">Receives a pointer to the allocated display-name string.</param>
void GetDisplayName(uint sigdnName, out nint ppszName);
/// Retrieves the item's display name in the specified format.
/// </summary>
/// <param name="sigdnName">The display name format to retrieve.</param>
/// <param name="ppszName">Receives a pointer to the allocated display-name string.</param>
void GetDisplayName(uint sigdnName, out nint ppszName);

/// <summary>
/// Retrieves the specified attributes of the shell item.
Expand Down
16 changes: 8 additions & 8 deletions QuickShell.Core/Services/CompanionAppCatalog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,14 @@ private static void EnsureFormChoicesCached()
}

/// <summary>
/// Serializes form choices into the JSON representation used by the companion app selector.
/// </summary>
/// <param name="choices">The form choice identifiers and display titles.</param>
/// <returns>The serialized form choices.</returns>
private static string SerializeFormChoices(IReadOnlyList<(string Id, string Title)> choices) =>
JsonSerializer.Serialize(
choices.Select(choice => new FormChoiceJson(choice.Title, choice.Id)).ToList(),
QuickShellJsonContext.Default.ListFormChoiceJson);
/// Serializes form choices into the JSON representation used by the companion app selector.
/// </summary>
/// <param name="choices">The form choice identifiers and display titles.</param>
/// <returns>The serialized form choices.</returns>
private static string SerializeFormChoices(IReadOnlyList<(string Id, string Title)> choices) =>
JsonSerializer.Serialize(
choices.Select(choice => new FormChoiceJson(choice.Title, choice.Id)).ToList(),
QuickShellJsonContext.Default.ListFormChoiceJson);
Comment thread
greptile-apps[bot] marked this conversation as resolved.
Outdated

/// <summary>
/// Builds the form choices for installed companion apps, including the options for no companion app and a custom app.
Expand Down
58 changes: 29 additions & 29 deletions QuickShell.Core/Services/QuickShellEventSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ private QuickShellEventSource()
}

/// <summary>
/// Determines whether the event source is enabled for listeners.
/// </summary>
/// <returns><c>true</c> if the event source is enabled; <c>false</c> otherwise.</returns>
bool IQuickShellEventSource.IsEnabled() => IsEnabled();
/// Determines whether the event source is enabled for listeners.
/// </summary>
/// <returns><c>true</c> if the event source is enabled; <c>false</c> otherwise.</returns>
bool IQuickShellEventSource.IsEnabled() => IsEnabled();

/// <summary>
/// Records a row cache diagnostic event.
Expand All @@ -38,23 +38,23 @@ private QuickShellEventSource()
public void WritePlanCache(string kind) => PlanCache(kind ?? string.Empty);

/// <summary>
/// Records the elapsed time for a startup span.
/// </summary>
/// <param name="name">The name of the startup span.</param>
/// <param name="elapsedMs">The elapsed time in milliseconds.</param>
[NonEvent]
/// Records the elapsed time for a startup span.
/// </summary>
/// <param name="name">The name of the startup span.</param>
/// <param name="elapsedMs">The elapsed time in milliseconds.</param>
[NonEvent]
public void WriteStartupSpan(string name, double elapsedMs) =>
StartupSpan(name ?? string.Empty, elapsedMs);
StartupSpan(name ?? string.Empty, elapsedMs);
Comment thread
greptile-apps[bot] marked this conversation as resolved.
Outdated

/// <summary>
/// Records a repository diagnostic event.
/// </summary>
/// <param name="location">The repository location.</param>
/// <param name="eventName">The name of the event.</param>
/// <param name="elapsedMs">The elapsed time in milliseconds, or null when unavailable.</param>
[NonEvent]
/// Records a repository diagnostic event.
/// </summary>
/// <param name="location">The repository location.</param>
/// <param name="eventName">The name of the event.</param>
/// <param name="elapsedMs">The elapsed time in milliseconds, or null when unavailable.</param>
[NonEvent]
public void WriteRepository(string location, string eventName, long? elapsedMs = null) =>
Repository(location ?? string.Empty, eventName ?? string.Empty, elapsedMs ?? -1);
Repository(location ?? string.Empty, eventName ?? string.Empty, elapsedMs ?? -1);

/// <summary>
/// Records a support event using the specified event code.
Expand All @@ -64,12 +64,12 @@ public void WriteRepository(string location, string eventName, long? elapsedMs =
public void WriteSupportEvent(string eventCode) => SupportEvent(eventCode ?? string.Empty);

/// <summary>
/// Records a support write failure event.
/// </summary>
/// <param name="exceptionType">The type of exception associated with the failure.</param>
[NonEvent]
/// Records a support write failure event.
/// </summary>
/// <param name="exceptionType">The type of exception associated with the failure.</param>
[NonEvent]
public void WriteSupportWriteFailure(string exceptionType) =>
SupportWriteFailure(exceptionType ?? string.Empty);
SupportWriteFailure(exceptionType ?? string.Empty);

/// <summary>
/// Records completion of Git repository discovery.
Expand Down Expand Up @@ -101,14 +101,14 @@ public void WriteSupportWriteFailure(string exceptionType) =>
public void StartupSpan(string name, double elapsedMs) => WriteEvent(3, name, elapsedMs);

/// <summary>
/// Records the elapsed time for a repository event.
/// </summary>
/// <param name="location">The repository location.</param>
/// <param name="eventName">The name of the repository event.</param>
/// <param name="elapsedMs">The elapsed time in milliseconds.</param>
[Event(4, Level = EventLevel.Informational, Message = "Repository {0} {1} elapsedMs={2}")]
/// Records the elapsed time for a repository event.
/// </summary>
/// <param name="location">The repository location.</param>
/// <param name="eventName">The name of the repository event.</param>
/// <param name="elapsedMs">The elapsed time in milliseconds.</param>
[Event(4, Level = EventLevel.Informational, Message = "Repository {0} {1} elapsedMs={2}")]
public void Repository(string location, string eventName, long elapsedMs) =>
WriteEvent(4, location, eventName, elapsedMs);
WriteEvent(4, location, eventName, elapsedMs);

/// <summary>
/// Records a support diagnostic event.
Expand Down
12 changes: 6 additions & 6 deletions QuickShell.Core/Services/RowPresentationDiagnostics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ public void Record(string eventName)
}

/// <summary>
/// Retrieves the recorded count for an event name.
/// </summary>
/// <param name="eventName">The name of the event to count.</param>
/// <returns>The recorded count, or zero if the event has not been recorded.</returns>
public long GetCount(string eventName) =>
_counters.TryGetValue(eventName, out var count) ? count : 0;
/// Retrieves the recorded count for an event name.
/// </summary>
/// <param name="eventName">The name of the event to count.</param>
/// <returns>The recorded count, or zero if the event has not been recorded.</returns>
public long GetCount(string eventName) =>
_counters.TryGetValue(eventName, out var count) ? count : 0;
}
Loading
Loading