-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Update the Copilot powered Inline Rename UX #76001
base: main
Are you sure you want to change the base?
Conversation
await Task.Delay(_smartRenameSession.AutomaticFetchDelay, cancellationToken) | ||
.ConfigureAwait(false); | ||
} | ||
this.IsInPreparation = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i would like some sort of threading asserts here. can talk mroe on what we often do in roslyn.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should also assert that we're not already 'in preparation'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please elaborate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should also assert that we're not already 'in preparation'.
This is already indirectly asserted above, through
if (_getSuggestionsTask.Status is TaskStatus.RanToCompletion or TaskStatus.Faulted or TaskStatus.Canceled)
{
...
_getSuggestionsTask = GetSuggestionsTaskAsync(isAutomaticOnInitialization, _cancellationTokenSource.Token).CompletesAsyncOperation(listenerToken);
}
Can you elaborate on threading asserts? This method should be free threaded; I believe it starts on UI thread (asserted in FetchSuggestions
, because FetchSuggestions
needs to avoid races in setting _getSuggestionsTask
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is already indirectly asserted above, through
I mean a literal retail assert that IsInPreparation must be false before setting it to true. Alternative, this can be in the setter, which retail asserts that the value is always flipping.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you elaborate on threading asserts? This method should be free threaded;
It is not ok to be free threaded. two threads might call in here, and end up with one setting the boolean back to false, while the other is still running.
src/EditorFeatures/Core.Wpf/InlineRename/UI/SmartRename/SmartRenameViewModel.cs
Outdated
Show resolved
Hide resolved
else | ||
{ | ||
_cancellationTokenSource?.Cancel(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how can the cts ever be null?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before FetchSuggestions
is ever called. It's defined as a nullable field.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very odd. I would expect it to just be 'new'ed up when we instantiate this type. :)
There is a slight delay prior to making Copilot request. Additionally, Roslyn might be gathering references and definition to add semantic context to the prompt.
Our UX designer recommended that we should be showing the progress bar while this is happening.
Before:
After:
Additionally, I saw that pressing Ctrl+Space to cancel ongoing request did not work, so I fixed it. In the "before" screenshot, I hit Ctrl+Space to cancel the request, then arrow down to scroll through suggestions, which were not visible
Before:
After: