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

Update the Copilot powered Inline Rename UX #76001

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

AmadeusW
Copy link
Contributor

@AmadeusW AmadeusW commented Nov 21, 2024

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:
roslyn rename progress delay

After:
roslyn rename progress fixed

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:
roslyn rename hidden suggestions

After:
roslyn rename abort fixed

@AmadeusW AmadeusW requested a review from a team as a code owner November 21, 2024 00:13
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Nov 21, 2024
@dotnet-policy-service dotnet-policy-service bot added the Community The pull request was submitted by a contributor who is not a Microsoft employee. label Nov 21, 2024
await Task.Delay(_smartRenameSession.AutomaticFetchDelay, cancellationToken)
.ConfigureAwait(false);
}
this.IsInPreparation = true;
Copy link
Member

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.

Copy link
Member

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'.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

please elaborate

Copy link
Contributor Author

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)

Copy link
Member

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.

Copy link
Member

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.

else
{
_cancellationTokenSource?.Cancel();
}
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

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. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE Community The pull request was submitted by a contributor who is not a Microsoft employee. untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants