mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-31 00:10:04 +08:00
@@ -793,6 +793,11 @@ export class ChatTipService extends Disposable implements IChatTipService {
|
||||
|
||||
getWelcomeTip(contextKeyService: IContextKeyService): IChatTip | undefined {
|
||||
this._createSlashCommandsUsageTracker.syncContextKey(contextKeyService);
|
||||
// Always record the current mode so that mode-based exclusions are
|
||||
// persisted even on stable-rerender paths (e.g. user switches to Plan
|
||||
// mode while viewing the Plan tip).
|
||||
this._tracker.recordCurrentMode(contextKeyService);
|
||||
|
||||
this._tracker.refreshPromptFileExclusions();
|
||||
// Check if tips are enabled
|
||||
if (!this._configurationService.getValue<boolean>('chat.tips.enabled')) {
|
||||
|
||||
@@ -723,6 +723,28 @@ suite('ChatTipService', () => {
|
||||
assert.ok(tip2, 'Should get a welcome tip after resetSession');
|
||||
});
|
||||
|
||||
test('Plan tip is excluded after switching to Plan mode during stable rerender', () => {
|
||||
const service = createService();
|
||||
// Start in Agent mode — Plan tip should be eligible
|
||||
contextKeyService.createKey(ChatContextKeys.chatModeKind.key, ChatModeKind.Agent);
|
||||
const modeNameKey = contextKeyService.createKey<string>(ChatContextKeys.chatModeName.key, 'Agent');
|
||||
|
||||
assert.ok(findTipById(service, 'tip.planMode'), 'Plan tip should be shown when in Agent mode');
|
||||
|
||||
// Simulate user switching to Plan mode (context keys update, widget rerenders)
|
||||
modeNameKey.set('Plan');
|
||||
|
||||
// Stable rerender — getWelcomeTip is called again without resetSession
|
||||
const rerenderTip = service.getWelcomeTip(contextKeyService);
|
||||
assert.ok(!rerenderTip || rerenderTip.id !== 'tip.planMode', 'Plan tip should not be shown after switching to Plan mode');
|
||||
|
||||
// New session in Agent mode — Plan tip must NOT reappear
|
||||
service.resetSession();
|
||||
modeNameKey.set('Agent');
|
||||
|
||||
assertTipNeverShown(service, 'tip.planMode');
|
||||
});
|
||||
|
||||
test('excludes tip when tracked tool has been invoked', () => {
|
||||
const mockToolsService = createMockToolsService();
|
||||
const tip: ITipDefinition = {
|
||||
|
||||
Reference in New Issue
Block a user