Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/instructions/kusto.instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: Kusto exploration and telemetry analysis instructions

When performing Kusto queries, telemetry analysis, or data exploration tasks for VS Code, consult the comprehensive Kusto instructions located at:

**[kusto-vscode-instructions.md](../../../vscode-internalbacklog/instructions/kusto/kusto-vscode-instructions.md)**
**[kusto-vscode-instructions.md](../../../vscode-tools/.github/skills/kusto-telemetry/kusto-vscode.instructions.md)**

These instructions contain valuable information about:
- Available Kusto clusters and databases for VS Code telemetry
Expand All @@ -16,4 +16,4 @@ These instructions contain valuable information about:

Reading these instructions before writing Kusto queries will help you write more accurate and efficient queries, avoid common pitfalls, and leverage existing knowledge about VS Code's telemetry infrastructure.

(Make sure to have the main branch of vscode-internalbacklog up to date in case there are problems).
(Make sure to have the main branch of vscode-tools up to date in case there are problems and the repository cloned from https://github.com/microsoft/vscode-tools).
3 changes: 2 additions & 1 deletion src/vs/sessions/browser/media/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,6 @@
.agent-sessions-workbench .interactive-session .interactive-input-part {
margin: 0 8px !important;
display: inherit !important;
padding: 4px 0 8px 0px !important;
/* Align with changes view */
padding: 4px 0 6px 0 !important;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { isMacintosh } from '../../../../base/common/platform.js';
import { Extensions, IConfigurationRegistry } from '../../../../platform/configuration/common/configurationRegistry.js';
import { Registry } from '../../../../platform/registry/common/platform.js';

Expand All @@ -11,6 +12,7 @@ Registry.as<IConfigurationRegistry>(Extensions.Configuration).registerDefaultCon
'chat.agent.maxRequests': 1000,
'chat.customizationsMenu.userStoragePath': '~/.copilot',
'chat.viewSessions.enabled': false,
'chat.notifyWindowOnConfirmation': isMacintosh ? 'always' : 'windowNotFocused', // macOS can confirm from the toast so we show it always
'chat.implicitContext.suggestedContext': false,

'breadcrumbs.enabled': false,
Expand Down
1 change: 1 addition & 0 deletions src/vs/workbench/contrib/chat/browser/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ export interface IChatWidgetViewOptions {
enableWorkingSet?: 'explicit' | 'implicit';
supportsChangingModes?: boolean;
dndContainer?: HTMLElement;
inputEditorMinLines?: number;
defaultMode?: IChatMode;
/**
* Optional delegate for the session target picker.
Expand Down
38 changes: 32 additions & 6 deletions src/vs/workbench/contrib/chat/browser/chatWindowNotifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ import { IWorkbenchContribution } from '../../../common/contributions.js';
import { IHostService } from '../../../services/host/browser/host.js';
import { IChatModel, IChatRequestNeedsInputInfo } from '../common/model/chatModel.js';
import { IChatService } from '../common/chatService/chatService.js';
import { migrateLegacyTerminalToolSpecificData } from '../common/chat.js';
import { ChatConfiguration, ChatNotificationMode } from '../common/constants.js';
import { IChatWidgetService } from './chat.js';
import { AcceptToolConfirmationActionId, IToolConfirmationActionContext } from './actions/chatToolActions.js';
import { isMacintosh } from '../../../../base/common/platform.js';

/**
* Observes all live chat models and triggers OS notifications when any model
Expand Down Expand Up @@ -107,15 +109,10 @@ export class ChatWindowNotifier extends Disposable implements IWorkbenchContribu
const actionLabel = isQuestionCarousel
? localize('openChatAction', "Open Chat")
: localize('allowAction', "Allow");
const body = info.detail
? this._sanitizeOSToastText(info.detail)
: isQuestionCarousel
? localize('questionCarouselDetail', "Questions need your input.")
: localize('notificationDetail', "Approval needed to continue.");

const result = await this._hostService.showToast({
title: this._sanitizeOSToastText(notificationTitle),
body,
body: this._getNotificationBody(sessionResource, info, isQuestionCarousel),
actions: [actionLabel],
}, cts.token);

Expand All @@ -134,6 +131,35 @@ export class ChatWindowNotifier extends Disposable implements IWorkbenchContribu
}
}

private _getNotificationBody(sessionResource: URI, info: IChatRequestNeedsInputInfo, isQuestionCarousel: boolean): string {
const terminalCommand = this._getPendingTerminalCommand(sessionResource);
if (isQuestionCarousel) {
return localize('questionCarouselDetail', "Questions need your input.");
}
if (isMacintosh && terminalCommand) {
return this._sanitizeOSToastText(terminalCommand); // prefer full command on macOS where you can approve from the toast
}
if (info.detail) {
return this._sanitizeOSToastText(info.detail);
}
return localize('notificationDetail', "Approval needed to continue.");
}

private _getPendingTerminalCommand(sessionResource: URI): string | undefined {
const model = this._chatService.getSession(sessionResource);
const lastResponse = model?.lastRequest?.response;
if (!lastResponse?.response?.value) {
return undefined;
}
for (const part of lastResponse.response.value) {
if (part.kind === 'toolInvocation' && part.toolSpecificData?.kind === 'terminal') {
const terminalData = migrateLegacyTerminalToolSpecificData(part.toolSpecificData);
return terminalData.commandLine.forDisplay ?? terminalData.commandLine.userEdited ?? terminalData.commandLine.toolEdited ?? terminalData.commandLine.original;
}
}
return undefined;
}

private _isQuestionCarouselPending(sessionResource: URI): boolean {
const model = this._chatService.getSession(sessionResource);
const lastResponse = model?.lastRequest?.response;
Expand Down
1 change: 1 addition & 0 deletions src/vs/workbench/contrib/chat/browser/widget/chatWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1715,6 +1715,7 @@ export class ChatWidget extends Disposable implements IChatWidget {
renderWorkingSet: this.viewOptions.enableWorkingSet === 'explicit',
supportsChangingModes: this.viewOptions.supportsChangingModes,
dndContainer: this.viewOptions.dndContainer,
inputEditorMinLines: this.viewOptions.inputEditorMinLines,
widgetViewKindTag: this.getWidgetViewKindTag(),
defaultMode: this.viewOptions.defaultMode,
sessionTypePickerDelegate: this.viewOptions.sessionTypePickerDelegate,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ export interface IChatInputPartOptions {
enableImplicitContext?: boolean;
supportsChangingModes?: boolean;
dndContainer?: HTMLElement;
inputEditorMinLines?: number;
widgetViewKindTag: string;
/**
* Optional delegate for the session target picker.
Expand Down Expand Up @@ -272,6 +273,7 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge
private readonly _contextResourceLabels: ResourceLabels;

private readonly inputEditorMaxHeight: number;
private readonly inputEditorMinHeight: number | undefined;
private inputEditorHeight: number = 0;
private container!: HTMLElement;

Expand Down Expand Up @@ -560,6 +562,7 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge
this.dnd = this._register(this.instantiationService.createInstance(ChatDragAndDrop, () => this._widget, this._attachmentModel, styles));

this.inputEditorMaxHeight = this.options.renderStyle === 'compact' ? INPUT_EDITOR_MAX_HEIGHT / 3 : INPUT_EDITOR_MAX_HEIGHT;
this.inputEditorMinHeight = this.options.inputEditorMinLines ? this.options.inputEditorMinLines * 20 + (this.options.renderStyle === 'compact' ? 4 : 16) : undefined; // lineHeight is 20, padding is top+bottom

this.inputEditorHasText = ChatContextKeys.inputHasText.bindTo(contextKeyService);
this.chatCursorAtTop = ChatContextKeys.inputCursorAtTop.bindTo(contextKeyService);
Expand Down Expand Up @@ -3004,7 +3007,7 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge

const initialEditorScrollWidth = this._inputEditor.getScrollWidth();
const newEditorWidth = width - data.inputPartHorizontalPadding - data.editorBorder - data.inputPartHorizontalPaddingInside - data.toolbarsWidth - data.sideToolbarWidth;
const inputEditorHeight = Math.min(this._inputEditor.getContentHeight(), this.inputEditorMaxHeight);
const inputEditorHeight = this.inputEditorMinHeight ? Math.max(this.inputEditorMinHeight, Math.min(this._inputEditor.getContentHeight(), this.inputEditorMaxHeight)) : Math.min(this._inputEditor.getContentHeight(), this.inputEditorMaxHeight);
const newDimension = { width: newEditorWidth, height: inputEditorHeight };
if (!this.previousInputEditorDimension || (this.previousInputEditorDimension.width !== newDimension.width || this.previousInputEditorDimension.height !== newDimension.height)) {
// This layout call has side-effects that are hard to understand. eg if we are calling this inside a onDidChangeContent handler, this can trigger the next onDidChangeContent handler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,7 @@ export class ChatViewPane extends ViewPane implements IViewWelcomeDelegate {
: 'explicit',
supportsChangingModes: true,
dndContainer: parent,
inputEditorMinLines: this.workbenchEnvironmentService.isSessionsWindow ? 2 : undefined,
},
{
listForeground: SIDE_BAR_FOREGROUND,
Expand Down
Loading