Skip to content

Commit

Permalink
feat(audoedit): reactive config singleton (#6530)
Browse files Browse the repository at this point in the history
Makes autoedits config singleton reactive to auth status. This is not
enough to make autoedits fully reactive and remove the requirement to
reload VS Code, but this part is required for analytics logger
integration tests I'll add in one of the follow-up PRs.
  • Loading branch information
valerybugakov authored Jan 6, 2025
1 parent 18a05dc commit 059fb08
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions vscode/src/autoedits/autoedits-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as vscode from 'vscode'
import {
type AutoEditsModelConfig,
type AutoEditsTokenLimit,
authStatus,
isDotComAuthed,
} from '@sourcegraph/cody-shared'

Expand Down Expand Up @@ -85,6 +86,10 @@ export function getAutoeditsProviderConfig(): AutoeditsProviderConfig {

/**
* A singleton for the static autoedits provider config.
* TODO: make it reactive to VS Code settings changes.
*/
export const autoeditsProviderConfig = getAutoeditsProviderConfig()
export let autoeditsProviderConfig = getAutoeditsProviderConfig()

// Recompute autoedits config on auth status change.
authStatus.subscribe(() => {
autoeditsProviderConfig = getAutoeditsProviderConfig()
})

0 comments on commit 059fb08

Please sign in to comment.