From 60bf10573c009ec03223e4ab520a692bf229f003 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Fri, 13 Feb 2026 14:42:23 +0000 Subject: [PATCH] Suppress chat tips in terminal/editor inline chat (#295170) --- .../contrib/chat/browser/chatTipService.ts | 17 ++++++++++++- .../chat/test/browser/chatTipService.test.ts | 24 ++++++++++++++++++- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/contrib/chat/browser/chatTipService.ts b/src/vs/workbench/contrib/chat/browser/chatTipService.ts index 862445cf50b..8cc8caf3e83 100644 --- a/src/vs/workbench/contrib/chat/browser/chatTipService.ts +++ b/src/vs/workbench/contrib/chat/browser/chatTipService.ts @@ -9,7 +9,7 @@ import { ContextKeyExpr, ContextKeyExpression, IContextKeyService } from '../../ import { createDecorator, IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js'; import { IProductService } from '../../../../platform/product/common/productService.js'; import { ChatContextKeys } from '../common/actions/chatContextKeys.js'; -import { ChatModeKind } from '../common/constants.js'; +import { ChatAgentLocation, ChatModeKind } from '../common/constants.js'; import { IConfigurationService } from '../../../../platform/configuration/common/configuration.js'; import { Disposable, MutableDisposable } from '../../../../base/common/lifecycle.js'; import { ICommandService } from '../../../../platform/commands/common/commands.js'; @@ -655,6 +655,11 @@ export class ChatTipService extends Disposable implements IChatTipService { return undefined; } + // Only show tips in the main chat panel, not in terminal/editor inline chat + if (!this._isChatLocation(contextKeyService)) { + return undefined; + } + // Check if this is the request that was assigned a tip (for stable rerenders) if (this._tipRequestId === requestId && this._shownTip) { return this._createTip(this._shownTip); @@ -693,6 +698,11 @@ export class ChatTipService extends Disposable implements IChatTipService { return undefined; } + // Only show tips in the main chat panel, not in terminal/editor inline chat + if (!this._isChatLocation(contextKeyService)) { + return undefined; + } + // Return the already-shown tip for stable rerenders if (this._tipRequestId === 'welcome' && this._shownTip) { return this._createTip(this._shownTip); @@ -769,6 +779,11 @@ export class ChatTipService extends Disposable implements IChatTipService { return true; } + private _isChatLocation(contextKeyService: IContextKeyService): boolean { + const location = contextKeyService.getContextKeyValue(ChatContextKeys.location.key); + return !location || location === ChatAgentLocation.Chat; + } + private _isCopilotEnabled(): boolean { const defaultChatAgent = this._productService.defaultChatAgent; return !!defaultChatAgent?.chatExtensionId; diff --git a/src/vs/workbench/contrib/chat/test/browser/chatTipService.test.ts b/src/vs/workbench/contrib/chat/test/browser/chatTipService.test.ts index 873bf370b92..bcd40b06767 100644 --- a/src/vs/workbench/contrib/chat/test/browser/chatTipService.test.ts +++ b/src/vs/workbench/contrib/chat/test/browser/chatTipService.test.ts @@ -19,7 +19,7 @@ import { ChatTipService, ITipDefinition, TipEligibilityTracker } from '../../bro import { AgentFileType, IPromptPath, IPromptsService, IResolvedAgentFile, PromptsStorage } from '../../common/promptSyntax/service/promptsService.js'; import { URI } from '../../../../../base/common/uri.js'; import { ChatContextKeys } from '../../common/actions/chatContextKeys.js'; -import { ChatModeKind } from '../../common/constants.js'; +import { ChatAgentLocation, ChatModeKind } from '../../common/constants.js'; import { PromptsType } from '../../common/promptSyntax/promptTypes.js'; import { ILanguageModelToolsService, IToolData, ToolDataSource } from '../../common/tools/languageModelToolsService.js'; import { MockLanguageModelToolsService } from '../common/tools/mockLanguageModelToolsService.js'; @@ -142,6 +142,28 @@ suite('ChatTipService', () => { assert.strictEqual(tip, undefined, 'Should not return a tip when tips setting is disabled'); }); + test('returns undefined when location is terminal', () => { + const service = createService(); + const now = Date.now(); + + const terminalContextKeyService = new MockContextKeyServiceWithRulesMatching(); + terminalContextKeyService.createKey(ChatContextKeys.location.key, ChatAgentLocation.Terminal); + + const tip = service.getNextTip('request-1', now + 1000, terminalContextKeyService); + assert.strictEqual(tip, undefined, 'Should not return a tip in terminal inline chat'); + }); + + test('returns undefined when location is editor inline', () => { + const service = createService(); + const now = Date.now(); + + const editorContextKeyService = new MockContextKeyServiceWithRulesMatching(); + editorContextKeyService.createKey(ChatContextKeys.location.key, ChatAgentLocation.EditorInline); + + const tip = service.getNextTip('request-1', now + 1000, editorContextKeyService); + assert.strictEqual(tip, undefined, 'Should not return a tip in editor inline chat'); + }); + test('old requests do not consume the session tip allowance', () => { const service = createService(); const now = Date.now();