Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ interface WatermarkEntry {
};
}

const showChatContextKey = ContextKeyExpr.and(ContextKeyExpr.equals('chatSetupHidden', false), ContextKeyExpr.equals('chatSetupDisabled', false));
const showChatContextKey = ContextKeyExpr.and(ContextKeyExpr.equals('chatSetupHidden', false));

const openChat: WatermarkEntry = { text: localize('watermark.openChat', "Open Chat"), id: 'workbench.action.chat.open', when: { native: showChatContextKey, web: showChatContextKey } };
const showCommands: WatermarkEntry = { text: localize('watermark.showCommands', "Show All Commands"), id: 'workbench.action.showCommands' };
Expand Down
2 changes: 0 additions & 2 deletions src/vs/workbench/contrib/chat/browser/actions/chatActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ abstract class OpenChatGlobalAction extends Action2 {
category: CHAT_CATEGORY,
precondition: ContextKeyExpr.and(
ChatContextKeys.Setup.hidden.negate(),
Comment thread
joaomoreno marked this conversation as resolved.
ChatContextKeys.Setup.disabled.negate()
)
});
}
Expand Down Expand Up @@ -1728,7 +1727,6 @@ MenuRegistry.appendMenuItem(MenuId.EditorContext, {
title: localize('generateCode', "Generate Code"),
when: ContextKeyExpr.and(
ChatContextKeys.Setup.hidden.negate(),
ChatContextKeys.Setup.disabled.negate()
)
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,6 @@ MenuRegistry.appendMenuItem(MenuId.TitleBar, {
ChatContextKeys.supported,
ContextKeyExpr.and(
ChatContextKeys.Setup.hidden.negate(),
ChatContextKeys.Setup.disabled.negate()
),
ContextKeyExpr.has('config.window.commandCenter').negate(),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ const chatViewDescriptor: IViewDescriptor = {
when: ContextKeyExpr.or(
ContextKeyExpr.or(
ChatContextKeys.Setup.hidden,
ChatContextKeys.Setup.disabled
)?.negate(),
ChatContextKeys.panelParticipantRegistered,
ChatContextKeys.extensionInvalid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export class ChatSetupContribution extends Disposable implements IWorkbenchContr

// Agent + Tools
{
if (!context.state.hidden && !context.state.disabled) {
if (!context.state.hidden) {

// Default Agents (always, even if installed to allow for speedy requests right on startup)
if (!defaultAgentDisposables.value) {
Expand Down Expand Up @@ -154,14 +154,14 @@ export class ChatSetupContribution extends Disposable implements IWorkbenchContr
vscodeAgentDisposables.clear();
}

if (context.state.completed && !context.state.disabled) {
if (context.state.completed) {
vscodeAgentDisposables.clear(); // we need to do this to prevent showing duplicate agent/tool entries in the list
}
}

// Rename Provider
{
if (!context.state.completed && !context.state.hidden && !context.state.disabled) {
if (!context.state.completed && !context.state.hidden) {
if (!renameProviderDisposables.value) {
renameProviderDisposables.value = AINewSymbolNamesProvider.registerProvider(this.instantiationService, context, controller);
}
Expand All @@ -172,7 +172,7 @@ export class ChatSetupContribution extends Disposable implements IWorkbenchContr

// Code Actions Provider
{
if (!context.state.completed && !context.state.hidden && !context.state.disabled) {
if (!context.state.completed && !context.state.hidden) {
if (!codeActionsProviderDisposables.value) {
codeActionsProviderDisposables.value = ChatCodeActionsProvider.registerProvider(this.instantiationService);
}
Expand Down Expand Up @@ -232,7 +232,6 @@ export class ChatSetupContribution extends Disposable implements IWorkbenchContr
f1: true,
precondition: ContextKeyExpr.or(
ChatContextKeys.Setup.hidden,
ChatContextKeys.Setup.disabled,
ChatContextKeys.Setup.untrusted,
ChatContextKeys.Setup.completed.negate(),
ChatContextKeys.Entitlement.canSignUp
Expand Down Expand Up @@ -559,7 +558,6 @@ export class ChatSetupContribution extends Disposable implements IWorkbenchContr

const internalGenerateCodeContext = ContextKeyExpr.and(
ChatContextKeys.Setup.hidden.negate(),
ChatContextKeys.Setup.disabled.negate(),
ChatContextKeys.Setup.completed.negate(),
);

Expand Down
1 change: 0 additions & 1 deletion src/vs/workbench/contrib/scm/browser/scm.contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,6 @@ registerAction2(class extends Action2 {
id: MenuId.EditorContent,
when: ContextKeyExpr.and(
ChatContextKeys.Setup.hidden.negate(),
ChatContextKeys.Setup.disabled.negate(),
ChatContextKeys.Setup.completed.negate(),
ContextKeyExpr.in(ResourceContextKey.Resource.key, 'git.mergeChanges'),
ContextKeyExpr.equals('git.activeResourceHasMergeConflicts', true)
Expand Down
1 change: 0 additions & 1 deletion src/vs/workbench/contrib/scm/browser/scmInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,6 @@ registerAction2(class extends Action2 {
id: MenuId.SCMInputBox,
when: ContextKeyExpr.and(
ChatContextKeys.Setup.hidden.negate(),
ChatContextKeys.Setup.disabled.negate(),
ChatContextKeys.Setup.completed.negate(),
ContextKeyExpr.equals('scmProvider', 'git')
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ function isAnonymous(configurationService: IConfigurationService, entitlement: C
return false; // only consider signed out users
}

if (sentiment.hidden || sentiment.disabled) {
if (sentiment.hidden) {
Comment thread
joaomoreno marked this conversation as resolved.
return false; // only consider enabled scenarios
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import { isString } from '../../../../base/common/types.js';
import { Delayer } from '../../../../base/common/async.js';
import { IProductService } from '../../../../platform/product/common/productService.js';
import { isWeb } from '../../../../base/common/platform.js';
import { ChatEntitlementService, IChatEntitlementService } from '../../chat/common/chatEntitlementService.js';

const SOURCE = 'IWorkbenchExtensionEnablementService';

Expand Down Expand Up @@ -75,6 +76,7 @@ export class ExtensionEnablementService extends Disposable implements IWorkbench
@IWorkspaceTrustManagementService private readonly workspaceTrustManagementService: IWorkspaceTrustManagementService,
@IWorkspaceTrustRequestService private readonly workspaceTrustRequestService: IWorkspaceTrustRequestService,
@IExtensionManifestPropertiesService private readonly extensionManifestPropertiesService: IExtensionManifestPropertiesService,
@IChatEntitlementService chatEntitlementService: IChatEntitlementService,
@IInstantiationService instantiationService: IInstantiationService,
@ILogService private readonly logService: ILogService,
@IProductService productService: IProductService
Expand Down Expand Up @@ -133,6 +135,34 @@ export class ExtensionEnablementService extends Disposable implements IWorkbench
});
});
}

if (!this.environmentService.isSessionsWindow) {
const builtinChatExtensionEnablementMigrationKey = 'builtinChatExtensionEnablementMigration';
const builtinChatExtensionEnablementMigration = this.storageService.getBoolean(builtinChatExtensionEnablementMigrationKey, StorageScope.PROFILE) === true;
if (!builtinChatExtensionEnablementMigration) {
this.logService.debug('Running builtin chat extension enablement migration');
this.storageService.store(builtinChatExtensionEnablementMigrationKey, true, StorageScope.PROFILE, StorageTarget.MACHINE);
const context = (chatEntitlementService as ChatEntitlementService).context;
if (context) {
Comment thread
joaomoreno marked this conversation as resolved.
if (context.value.state.completed) {
if (this._isDisabledGlobally({ id: this._chatExtensionId })) {
if (this.configurationService.getValue('chat.disableAIFeatures') !== true) {
this.logService.debug('Disabling AI features because builtin chat extension is disabled');
this.configurationService.updateValue('chat.disableAIFeatures', true)
.catch(err => this.logService.error('Failed to update chat.disableAIFeatures setting during builtin chat extension enablement migration', err));
}
}
} else {
try {
this.logService.debug('Disabling builtin chat extension as chat set up is not completed');
this._disableExtension({ id: this._chatExtensionId });
} catch (error) {
this.logService.error('Failed to disable builtin chat extension during enablement migration', error);
}
}
}
}
}
}

private get hasWorkspace(): boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { mock } from '../../../../../base/test/common/mock.js';
import { IExtensionBisectService } from '../../browser/extensionBisect.js';
import { IWorkspaceTrustManagementService, IWorkspaceTrustRequestService, WorkspaceTrustRequestOptions } from '../../../../../platform/workspace/common/workspaceTrust.js';
import { ExtensionManifestPropertiesService, IExtensionManifestPropertiesService } from '../../../extensions/common/extensionManifestPropertiesService.js';
import { TestContextService, TestProductService, TestWorkspaceTrustEnablementService, TestWorkspaceTrustManagementService } from '../../../../test/common/workbenchTestServices.js';
import { TestChatEntitlementService, TestContextService, TestProductService, TestWorkspaceTrustEnablementService, TestWorkspaceTrustManagementService } from '../../../../test/common/workbenchTestServices.js';
import { TestWorkspace } from '../../../../../platform/workspace/test/common/testWorkspace.js';
import { ExtensionManagementService } from '../../common/extensionManagementService.js';
import { ILogService, NullLogService } from '../../../../../platform/log/common/log.js';
Expand Down Expand Up @@ -97,6 +97,7 @@ export class TestExtensionEnablementService extends ExtensionEnablementService {
workspaceTrustManagementService,
new class extends mock<IWorkspaceTrustRequestService>() { override requestWorkspaceTrust(options?: WorkspaceTrustRequestOptions): Promise<boolean> { return Promise.resolve(true); } },
instantiationService.get(IExtensionManifestPropertiesService) || instantiationService.stub(IExtensionManifestPropertiesService, disposables.add(new ExtensionManifestPropertiesService(TestProductService, new TestConfigurationService(), new TestWorkspaceTrustEnablementService(), new NullLogService()))),
new TestChatEntitlementService(),
instantiationService,
new NullLogService(),
productService
Comment thread
joaomoreno marked this conversation as resolved.
Expand Down
Loading