diff --git a/src/vs/workbench/contrib/chat/browser/actions/chatActions.ts b/src/vs/workbench/contrib/chat/browser/actions/chatActions.ts index 29731511a132a..79cf60bebcfa4 100644 --- a/src/vs/workbench/contrib/chat/browser/actions/chatActions.ts +++ b/src/vs/workbench/contrib/chat/browser/actions/chatActions.ts @@ -158,7 +158,8 @@ class ChatHistoryAction extends Action2 { picker.items = getPicks(); store.add(picker.onDidTriggerItemButton(context => { if (context.button === openInEditorButton) { - editorService.openEditor({ resource: ChatEditorInput.getNewEditorUri(), options: { target: { sessionId: context.item.chat.sessionId }, pinned: true } }, ACTIVE_GROUP); + const options: IChatEditorOptions = { target: { sessionId: context.item.chat.sessionId }, pinned: true }; + editorService.openEditor({ resource: ChatEditorInput.getNewEditorUri(), options }, ACTIVE_GROUP); picker.hide(); } else if (context.button === deleteButton) { chatService.removeHistoryEntry(context.item.chat.sessionId); diff --git a/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.ts b/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.ts index b4d1afffad32a..977cf2f7a1493 100644 --- a/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.ts +++ b/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.ts @@ -96,7 +96,8 @@ export function registerChatExportActions() { throw new Error('Invalid chat session data'); } - await editorService.openEditor({ resource: ChatEditorInput.getNewEditorUri(), options: { target: { data }, pinned: true } as IChatEditorOptions }); + const options: IChatEditorOptions = { target: { data }, pinned: true }; + await editorService.openEditor({ resource: ChatEditorInput.getNewEditorUri(), options }); } catch (err) { throw err; } diff --git a/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.ts b/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.ts index d04e49d62188c..0f960b81e71eb 100644 --- a/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.ts +++ b/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.ts @@ -96,7 +96,7 @@ async function executeMoveToAction(accessor: ServicesAccessor, moveTo: MoveToNew const widget = chatView?.widget ?? widgetService.lastFocusedWidget; if (!widget || !('viewId' in widget.viewContext)) { - await editorService.openEditor({ resource: ChatEditorInput.getNewEditorUri(), options: { pinned: true } }, moveTo === MoveToNewLocation.Window ? AUX_WINDOW_GROUP : ACTIVE_GROUP); + await editorService.openEditor({ resource: ChatEditorInput.getNewEditorUri(), options: { pinned: true } }, moveTo === MoveToNewLocation.Window ? AUX_WINDOW_GROUP : ACTIVE_GROUP); return; } @@ -109,7 +109,8 @@ async function executeMoveToAction(accessor: ServicesAccessor, moveTo: MoveToNew const viewState = widget.getViewState(); widget.clear(); - await editorService.openEditor({ resource: ChatEditorInput.getNewEditorUri(), options: { target: { sessionId }, pinned: true, viewState: viewState } }, moveTo === MoveToNewLocation.Window ? AUX_WINDOW_GROUP : ACTIVE_GROUP); + const options: IChatEditorOptions = { target: { sessionId }, pinned: true, viewState: viewState }; + await editorService.openEditor({ resource: ChatEditorInput.getNewEditorUri(), options }, moveTo === MoveToNewLocation.Window ? AUX_WINDOW_GROUP : ACTIVE_GROUP); } async function moveToSidebar(accessor: ServicesAccessor): Promise { diff --git a/src/vs/workbench/contrib/chat/browser/contrib/chatDynamicVariables.ts b/src/vs/workbench/contrib/chat/browser/contrib/chatDynamicVariables.ts index 85b3f5d5df40f..a81f88f9367c4 100644 --- a/src/vs/workbench/contrib/chat/browser/contrib/chatDynamicVariables.ts +++ b/src/vs/workbench/contrib/chat/browser/contrib/chatDynamicVariables.ts @@ -99,18 +99,18 @@ export class ChatDynamicVariableModel extends Disposable implements IChatWidgetC } private updateDecorations(): void { - this.widget.inputEditor.setDecorationsByType('chat', dynamicVariableDecorationType, this._variables.map(r => ({ + this.widget.inputEditor.setDecorationsByType('chat', dynamicVariableDecorationType, this._variables.map((r): IDecorationOptions => ({ range: r.range, hoverMessage: this.getHoverForReference(r) }))); } - private getHoverForReference(ref: IDynamicVariable): string | IMarkdownString { + private getHoverForReference(ref: IDynamicVariable): IMarkdownString | undefined { const value = ref.data; if (URI.isUri(value)) { return new MarkdownString(this.labelService.getUriLabel(value, { relative: true })); } else { - return (value as any).toString(); + return undefined; } } } @@ -162,11 +162,10 @@ export class SelectAndInsertFileAction extends Action2 { // This of course assumes that the `files` variable has the behavior that it searches // through files in the workspace. if (chatVariablesService.hasVariable(SelectAndInsertFileAction.Name)) { - options = { - providerOptions: { - additionPicks: [SelectAndInsertFileAction.Item, { type: 'separator' }] - }, + const providerOptions: AnythingQuickAccessProviderRunOptions = { + additionPicks: [SelectAndInsertFileAction.Item, { type: 'separator' }] }; + options = { providerOptions }; } // TODO: have dedicated UX for this instead of using the quick access picker const picks = await quickInputService.quickAccess.pick('', options); diff --git a/src/vs/workbench/contrib/chat/common/chatModel.ts b/src/vs/workbench/contrib/chat/common/chatModel.ts index 1d2cc91f2fb06..4eb2b9f3816b5 100644 --- a/src/vs/workbench/contrib/chat/common/chatModel.ts +++ b/src/vs/workbench/contrib/chat/common/chatModel.ts @@ -771,6 +771,7 @@ export class ChatModel extends Disposable implements IChatModel { // Port entries from old format const result = 'responseErrorDetails' in raw ? + // eslint-disable-next-line local/code-no-dangerous-type-assertions { errorDetails: raw.responseErrorDetails } as IChatAgentResult : raw.result; request.response = new ChatResponseModel(raw.response ?? [new MarkdownString(raw.response)], this, agent, raw.slashCommand, request.id, true, raw.isCanceled, raw.vote, result, raw.followups); if (raw.usedContext) { // @ulugbekna: if this's a new vscode sessions, doc versions are incorrect anyway?