-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
76 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
src/EditorFeatures/Core.Wpf/InlineRename/UI/SmartRename/SmartRenameViewModel_Telemetry.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
using System.Diagnostics.CodeAnalysis; | ||
using Microsoft.CodeAnalysis.Editor.InlineRename; | ||
using Microsoft.CodeAnalysis.Internal.Log; | ||
using Microsoft.CodeAnalysis.Telemetry; | ||
using Roslyn.Utilities; | ||
|
||
namespace Microsoft.CodeAnalysis.InlineRename.UI.SmartRename | ||
{ | ||
internal partial class SmartRenameViewModel | ||
{ | ||
private SuggestionsPanelTelemetry? _suggestionsPanelTelemetry; | ||
private SuggestionsDropdownTelemetry? _suggestionsDropdownTelemetry; | ||
|
||
private sealed class SuggestionsPanelTelemetry | ||
{ | ||
public bool CollapseSuggestionsPanelWhenRenameStarts { get; set; } | ||
} | ||
|
||
private sealed class SuggestionsDropdownTelemetry | ||
{ | ||
public int DropdownButtonClickTimes { get; set; } | ||
} | ||
|
||
private void SetupTelemetry() | ||
{ | ||
var getSuggestionsAutomatically = _globalOptionService.GetOption(InlineRenameUIOptionsStorage.GetSuggestionsAutomatically); | ||
if (getSuggestionsAutomatically) | ||
{ | ||
_suggestionsPanelTelemetry = new SuggestionsPanelTelemetry | ||
{ | ||
CollapseSuggestionsPanelWhenRenameStarts = _globalOptionService.GetOption(InlineRenameUIOptionsStorage.CollapseSuggestionsPanel) | ||
}; | ||
} | ||
else | ||
{ | ||
_suggestionsDropdownTelemetry = new SuggestionsDropdownTelemetry(); | ||
} | ||
} | ||
|
||
private void PostTelemetry(bool isCommit) | ||
{ | ||
if (_suggestionsPanelTelemetry is not null) | ||
{ | ||
RoslynDebug.Assert(_suggestionsDropdownTelemetry is null); | ||
TelemetryLogging.Log(FunctionId.Copilot_Rename, KeyValueLogMessage.Create(m => | ||
{ | ||
m[nameof(isCommit)] = isCommit; | ||
m["UseSuggestionsPanel"] = true; | ||
m[nameof(SuggestionsPanelTelemetry.CollapseSuggestionsPanelWhenRenameStarts)] = _suggestionsPanelTelemetry.CollapseSuggestionsPanelWhenRenameStarts; | ||
m["CollapseSuggestionsPanelWhenRenameEnds"] = _globalOptionService.GetOption(InlineRenameUIOptionsStorage.CollapseSuggestionsPanel); | ||
})); | ||
} | ||
else | ||
{ | ||
RoslynDebug.Assert(_suggestionsDropdownTelemetry is not null); | ||
TelemetryLogging.Log(FunctionId.Copilot_Rename, KeyValueLogMessage.Create(m => | ||
{ | ||
m[nameof(isCommit)] = isCommit; | ||
m["UseDropDown"] = true; | ||
m[nameof(SuggestionsDropdownTelemetry.DropdownButtonClickTimes)] = _suggestionsDropdownTelemetry.DropdownButtonClickTimes; | ||
})); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters