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

On-the-fly-docs -- Add quota exceeded dialogue #76877

Merged

Conversation

akhera99
Copy link
Member

Updates OnTheFlyDocsView.xaml.vs to handle and display quota exceeded messages.
Updates ICopilotCodeAnalysisService to retrieve the status of the response from Copilot.

image
image

@akhera99 akhera99 requested a review from a team as a code owner January 23, 2025 01:08
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Jan 23, 2025
@akhera99 akhera99 requested a review from genlu January 23, 2025 01:08
@@ -18,6 +18,6 @@ internal interface IExternalCSharpCopilotCodeAnalysisService
Task<ImmutableArray<Diagnostic>> AnalyzeDocumentAsync(Document document, TextSpan? span, string promptTitle, CancellationToken cancellationToken);
Task<ImmutableArray<Diagnostic>> GetCachedDiagnosticsAsync(Document document, string promptTitle, CancellationToken cancellationToken);
Task StartRefinementSessionAsync(Document oldDocument, Document newDocument, Diagnostic? primaryDiagnostic, CancellationToken cancellationToken);
Task<string> GetOnTheFlyDocsAsync(string symbolSignature, ImmutableArray<string> declarationCode, string language, CancellationToken cancellationToken);
Task<(string ResponseString, int ResponseStatus)> GetOnTheFlyDocsAsync(string symbolSignature, ImmutableArray<string> declarationCode, string language, CancellationToken cancellationToken);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Task<(string ResponseString, int ResponseStatus)> GetOnTheFlyDocsAsync(string symbolSignature, ImmutableArray<string> declarationCode, string language, CancellationToken cancellationToken);
Task<(string responseString, int responseStatus)> GetOnTheFlyDocsAsync(string symbolSignature, ImmutableArray<string> declarationCode, string language, CancellationToken cancellationToken);

Note: we recommmend not using tuples for apis shared among teams. define a real type that can be passed around.

also: is there a binary breaking change concern here?

Comment on lines 146 to 147
ClassifiedTextElement.TextClassificationTypeName,
quotaExceededMatch.Groups[1].Value),
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
ClassifiedTextElement.TextClassificationTypeName,
quotaExceededMatch.Groups[1].Value),
ClassifiedTextElement.TextClassificationTypeName,
quotaExceededMatch.Groups[1].Value),

var copilotRequestTime = stopwatch.Elapsed;

await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

cancellationToken.ThrowIfCancellationRequested();

if (response is null || response.Length == 0)
if (responseString is null || responseString.Length == 0)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if (responseString is null || responseString.Length == 0)
if (string.IsNullOrEmpty(responseString))

Comment on lines 304 to 309
var elements = new List<object>
{
new ContainerElement(ContainerElementStyle.Wrapped, new ClassifiedTextElement(this.quotaExceededContent))
};

_responseControl.Content = ToUIElement(new ContainerElement(ContainerElementStyle.Stacked, elements));
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
var elements = new List<object>
{
new ContainerElement(ContainerElementStyle.Wrapped, new ClassifiedTextElement(this.quotaExceededContent))
};
_responseControl.Content = ToUIElement(new ContainerElement(ContainerElementStyle.Stacked, elements));
_responseControl.Content = ToUIElement(
new ContainerElement(ContainerElementStyle.Stacked,
[new ContainerElement(ContainerElementStyle.Wrapped, new ClassifiedTextElement(this.quotaExceededContent))]));

@akhera99 akhera99 merged commit 6f29e13 into dotnet:main Jan 23, 2025
25 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Jan 23, 2025
akhera99 added a commit to akhera99/roslyn that referenced this pull request Jan 23, 2025
* wip

* wip

* revert

* comments

* pr feedback

* pr feedback

* pr feedback
akhera99 added a commit that referenced this pull request Jan 25, 2025
* wip

* wip

* revert

* comments

* pr feedback

* pr feedback

* pr feedback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead VSCode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants