Skip to content

Commit

Permalink
Initialize AIActivationService from preferences
Browse files Browse the repository at this point in the history
In our Theia-derived IDE, the AI feature sometimes is not enabled
properly, even though the setting is enabled. We traced this down
to the AIActivationServer depending on a signal from the
PreferenceService.

FIxes eclipse-theia#15043

Signed-off-by: Florian Richter <[email protected]>
  • Loading branch information
mvtec-richter committed Feb 25, 2025
1 parent 3dde0ac commit 7ae56fd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/ai-core/src/browser/ai-activation-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ export class AIActivationService implements FrontendApplicationContribution {
}

initialize(): MaybePromise<void> {
this.isAiEnabledKey = this.contextKeyService.createKey(ENABLE_AI_CONTEXT_KEY, false);
const value = this.preferenceService.get<boolean>(ENABLE_AI_CONTEXT_KEY);
this.isAiEnabledKey = this.contextKeyService.createKey(ENABLE_AI_CONTEXT_KEY, value);
this.preferenceService.onPreferenceChanged(e => {
if (e.preferenceName === PREFERENCE_NAME_ENABLE_AI) {
this.isAiEnabledKey.set(e.newValue);
Expand Down

0 comments on commit 7ae56fd

Please sign in to comment.