Skip to content

Commit ec4cf2e

Browse files
authored
Merge pull request microsoft#258245 from microsoft/tyriar/258230
Add note about shell integration when not detected
2 parents 8151655 + e9a8d5e commit ec4cf2e

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

src/vs/workbench/contrib/chat/browser/chatContentParts/toolInvocationParts/chatTerminalMarkdownProgressPart.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,14 @@ export class ChatTerminalMarkdownProgressPart extends BaseChatToolInvocationSubP
4040

4141
const command = terminalData.commandLine.userEdited ?? terminalData.commandLine.toolEdited ?? terminalData.commandLine.original;
4242

43-
const content = new MarkdownString(`\`\`\`${terminalData.language}\n${command}\n\`\`\``);
43+
let content = `\`\`\`${terminalData.language}\n${command}\n\`\`\``;
44+
if (toolInvocation.pastTenseMessage) {
45+
content += `\n\n$(info) ${typeof toolInvocation.pastTenseMessage === 'string' ? toolInvocation.pastTenseMessage : toolInvocation.pastTenseMessage.value}`;
46+
}
47+
const markdownContent = new MarkdownString(content, { supportThemeIcons: true });
4448
const chatMarkdownContent: IChatMarkdownContent = {
4549
kind: 'markdownContent',
46-
content: content,
50+
content: markdownContent,
4751
};
4852

4953
const codeBlockRenderOptions: ICodeBlockRenderOptions = {

src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalTool.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import type { IMarker as IXtermMarker } from '@xterm/xterm';
77
import { timeout } from '../../../../../base/common/async.js';
88
import { CancellationToken } from '../../../../../base/common/cancellation.js';
99
import { CancellationError } from '../../../../../base/common/errors.js';
10-
import { MarkdownString } from '../../../../../base/common/htmlContent.js';
10+
import { MarkdownString, type IMarkdownString } from '../../../../../base/common/htmlContent.js';
1111
import { Disposable, DisposableStore } from '../../../../../base/common/lifecycle.js';
1212
import { OperatingSystem, OS } from '../../../../../base/common/platform.js';
1313
import { count } from '../../../../../base/common/strings.js';
@@ -22,11 +22,13 @@ import { ITerminalLogService } from '../../../../../platform/terminal/common/ter
2222
import { IWorkspaceContextService } from '../../../../../platform/workspace/common/workspace.js';
2323
import { IRemoteAgentService } from '../../../../services/remote/common/remoteAgentService.js';
2424
import { IChatService, type IChatTerminalToolInvocationData } from '../../../chat/common/chatService.js';
25+
import { ILanguageModelsService } from '../../../chat/common/languageModels.js';
2526
import { CountTokensCallback, ILanguageModelToolsService, IPreparedToolInvocation, IToolData, IToolImpl, IToolInvocation, IToolInvocationPreparationContext, IToolResult, ToolDataSource, ToolProgress, type IToolConfirmationMessages } from '../../../chat/common/languageModelToolsService.js';
2627
import { ITerminalService, type ITerminalInstance } from '../../../terminal/browser/terminal.js';
2728
import type { XtermTerminal } from '../../../terminal/browser/xterm/xtermTerminal.js';
2829
import { ITerminalProfileResolverService } from '../../../terminal/common/terminal.js';
2930
import { getRecommendedToolsOverRunInTerminal } from './alternativeRecommendation.js';
31+
import { getOutput, pollForOutputAndIdle, promptForMorePolling, racePollingOrPrompt } from './bufferOutputPolling.js';
3032
import { CommandLineAutoApprover } from './commandLineAutoApprover.js';
3133
import { BasicExecuteStrategy } from './executeStrategy/basicExecuteStrategy.js';
3234
import type { ITerminalExecuteStrategy } from './executeStrategy/executeStrategy.js';
@@ -35,8 +37,6 @@ import { RichExecuteStrategy } from './executeStrategy/richExecuteStrategy.js';
3537
import { isPowerShell } from './runInTerminalHelpers.js';
3638
import { extractInlineSubCommands, splitCommandLineIntoSubCommands } from './subCommands.js';
3739
import { ShellIntegrationQuality, ToolTerminalCreator, type IToolTerminal } from './toolTerminalCreator.js';
38-
import { ILanguageModelsService } from '../../../chat/common/languageModels.js';
39-
import { getOutput, pollForOutputAndIdle, promptForMorePolling, racePollingOrPrompt } from './bufferOutputPolling.js';
4040

4141
const TERMINAL_SESSION_STORAGE_KEY = 'chat.terminalSessions';
4242

@@ -262,6 +262,7 @@ export class RunInTerminalTool extends Disposable implements IToolImpl {
262262
if (!toolSpecificData) {
263263
throw new Error('toolSpecificData must be provided for this tool');
264264
}
265+
let toolResultMessage: string | IMarkdownString | undefined;
265266

266267
const chatSessionId = invocation.context?.sessionId;
267268
if (!invocation.context || chatSessionId === undefined) {
@@ -397,6 +398,7 @@ export class RunInTerminalTool extends Disposable implements IToolImpl {
397398
switch (toolTerminal.shellIntegrationQuality) {
398399
case ShellIntegrationQuality.None: {
399400
strategy = this._instantiationService.createInstance(NoneExecuteStrategy, toolTerminal.instance);
401+
toolResultMessage = new MarkdownString('Enable [shell integration](https://code.visualstudio.com/docs/terminal/shell-integration) to improve command detection');
400402
break;
401403
}
402404
case ShellIntegrationQuality.Basic: {
@@ -461,6 +463,7 @@ export class RunInTerminalTool extends Disposable implements IToolImpl {
461463
resultText.push(terminalResult);
462464

463465
return {
466+
toolResultMessage,
464467
content: [{
465468
kind: 'text',
466469
value: resultText.join(''),

0 commit comments

Comments
 (0)