Show /create-* chat tip only in local sessions (#297016)

This commit is contained in:
Copilot
2026-02-23 16:13:36 +00:00
committed by GitHub
parent 4273cad578
commit db8faee5ff
2 changed files with 21 additions and 1 deletions
@@ -182,7 +182,10 @@ const TIP_CATALOG: ITipDefinition[] = [
'tip.createSlashCommands',
"Tip: Use [/create-instruction](command:workbench.action.chat.generateInstruction), [/create-prompt](command:workbench.action.chat.generatePrompt), [/create-agent](command:workbench.action.chat.generateAgent), or [/create-skill](command:workbench.action.chat.generateSkill) to generate reusable agent customization files."
),
when: ChatContextKeys.hasUsedCreateSlashCommands.negate(),
when: ContextKeyExpr.and(
ChatContextKeys.chatSessionType.isEqualTo(localChatSessionType),
ChatContextKeys.hasUsedCreateSlashCommands.negate(),
),
enabledCommands: [
'workbench.action.chat.generateInstruction',
'workbench.action.chat.generatePrompt',
@@ -33,6 +33,7 @@ import { OffsetRange } from '../../../../../editor/common/core/ranges/offsetRang
import { Range } from '../../../../../editor/common/core/range.js';
import { ITelemetryService } from '../../../../../platform/telemetry/common/telemetry.js';
import { NullTelemetryService } from '../../../../../platform/telemetry/common/telemetryUtils.js';
import { localChatSessionType } from '../../common/chatSessionsService.js';
class MockContextKeyServiceWithRulesMatching extends MockContextKeyService {
override contextMatchesRules(rules: ContextKeyExpression): boolean {
@@ -769,6 +770,7 @@ suite('ChatTipService', () => {
test('shows tip.createSlashCommands when context key is false', () => {
const service = createService();
contextKeyService.createKey(ChatContextKeys.hasUsedCreateSlashCommands.key, false);
contextKeyService.createKey(ChatContextKeys.chatSessionType.key, localChatSessionType);
// Dismiss tips until we find createSlashCommands or run out
let found = false;
@@ -787,6 +789,21 @@ suite('ChatTipService', () => {
assert.ok(found, 'Should eventually show tip.createSlashCommands when context key is false');
});
test('does not show tip.createSlashCommands in non-local chat sessions', () => {
const service = createService();
contextKeyService.createKey(ChatContextKeys.hasUsedCreateSlashCommands.key, false);
contextKeyService.createKey(ChatContextKeys.chatSessionType.key, 'cloud');
for (let i = 0; i < 100; i++) {
const tip = service.getWelcomeTip(contextKeyService);
if (!tip) {
break;
}
assert.notStrictEqual(tip.id, 'tip.createSlashCommands', 'Should not show tip.createSlashCommands in non-local sessions');
service.dismissTip();
}
});
test('does not show tip.createSlashCommands when context key is true', () => {
storageService.store('chat.tips.usedCreateSlashCommands', true, StorageScope.APPLICATION, StorageTarget.MACHINE);
const service = createService();