Skip to content

Commit a914151

Browse files
authored
Auto Enablement Logic (#2428)
1 parent 64d9726 commit a914151

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/extension/inlineEdits/vscode-node/inlineEditProviderFeature.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,18 +104,22 @@ export class InlineEditProviderFeature {
104104
public rolloutFeature(): IDisposable {
105105
const hasUpdatedNesSettingKey = 'copilot.chat.nextEdits.hasEnabledNesInSettings';
106106

107-
return autorun((reader) => {
108-
const copilotToken = this._copilotToken.read(reader);
107+
return autorun(async (reader) => {
108+
if (this._vscodeExtensionContext.globalState.get<boolean | undefined>(hasUpdatedNesSettingKey)) {
109+
return; // We already updated the setting for the user once. No need to run this logic again.
110+
}
109111

112+
const copilotToken = this._copilotToken.read(reader);
110113
if (copilotToken === undefined) {
111114
return;
112115
}
113116

114-
if (
115-
this._expService.getTreatmentVariable<boolean>('copilotchat.enableNesInSettings') &&
116-
this._vscodeExtensionContext.globalState.get<boolean | undefined>(hasUpdatedNesSettingKey) !== true &&
117-
!copilotToken.isFreeUser
118-
) {
117+
if (copilotToken.isFreeUser || copilotToken.isNoAuthUser) {
118+
return;
119+
}
120+
121+
await this._expService.hasTreatments();
122+
if (!this._expService.getTreatmentVariable<boolean>('copilotchat.avoidEnablingNesInSettings')) {
119123
this._vscodeExtensionContext.globalState.update(hasUpdatedNesSettingKey, true);
120124
if (!this._configurationService.isConfigured(ConfigKey.InlineEditsEnabled)) {
121125
this._configurationService.setConfig(ConfigKey.InlineEditsEnabled, true);

0 commit comments

Comments
 (0)