Skip to content

Commit

Permalink
Autocomplete: Don't show loading spinner when rate limited (#2314)
Browse files Browse the repository at this point in the history
  • Loading branch information
philipp-spiess committed Dec 12, 2023
1 parent 7153175 commit 0a50423
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions vscode/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ This is a log of all notable changes to Cody for VS Code. [Unreleased] changes a

### Fixed

- Autocomplete: Don't show loading indicator when a user is rate limited. [pull/2314](https://github.com/sourcegraph/cody/pull/2314)
- Fixes an issue where the wrong rate limit count was shown. [pull/2312](https://github.com/sourcegraph/cody/pull/2312)

### Changed
Expand Down
9 changes: 8 additions & 1 deletion vscode/src/completions/inline-completion-item-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,14 @@ export class InlineCompletionItemProvider implements vscode.InlineCompletionItem
let stopLoading: () => void | undefined
const setIsLoading = (isLoading: boolean): void => {
if (isLoading) {
stopLoading = this.config.statusBar.startLoading('Completions are being generated')
// We do not want to show a loading spinner when the user is rate limited to
// avoid visual churn.
//
// We still make the request to find out if the user is still rate limited.
const hasRateLimitError = this.config.statusBar.hasError(RateLimitError.errorName)
if (!hasRateLimitError) {
stopLoading = this.config.statusBar.startLoading('Completions are being generated')
}
} else {
stopLoading?.()
}
Expand Down

0 comments on commit 0a50423

Please sign in to comment.