Run /compact command in chat instead of spawning terminal

The /compact command now executes through the chat interface using
the existing Claude process, providing a seamless user experience
instead of opening a separate terminal window.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
andrepimenta
2025-12-02 18:12:46 +00:00
parent a156881a08
commit 14ac46018f
2 changed files with 16 additions and 6 deletions

View File

@@ -2637,6 +2637,12 @@ class ClaudeChatProvider {
}
private _executeSlashCommand(command: string): void {
// Handle /compact in chat instead of spawning a terminal
if (command === 'compact') {
this._sendMessageToClaude(`/${command}`);
return;
}
const config = vscode.workspace.getConfiguration('claudeCodeChat');
const wslEnabled = config.get<boolean>('wsl.enabled', false);
const wslDistro = config.get<string>('wsl.distro', 'Ubuntu');

View File

@@ -1683,15 +1683,19 @@ const getScript = (isTelemetryEnabled: boolean) => `<script>
// Clear the input since user selected a command
messageInput.value = '';
// Send command to VS Code to execute in terminal
// Send command to VS Code to execute
vscode.postMessage({
type: 'executeSlashCommand',
command: command
});
// Show user feedback
// Show user feedback - /compact runs in chat, others in terminal
if (command === 'compact') {
// No message needed - compact runs in chat and shows its own status
} else {
addMessage('user', \`Executing /\${command} command in terminal. Check the terminal output and return when ready.\`, 'assistant');
}
}
function handleCustomCommandKeydown(event) {
if (event.key === 'Enter') {