clean up dead context keys and other dead code (#213387)

This commit is contained in:
Johannes Rieken 2024-05-24 14:07:41 +02:00 committed by GitHub
parent de1410c53f
commit e67cdb56b1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 29 additions and 79 deletions

View file

@ -43,7 +43,7 @@ import { isResponseVM } from 'vs/workbench/contrib/chat/common/chatViewModel';
import { IVoiceChatService, VoiceChatInProgress as GlobalVoiceChatInProgress } from 'vs/workbench/contrib/chat/common/voiceChatService';
import { IExtensionsWorkbenchService } from 'vs/workbench/contrib/extensions/common/extensions';
import { InlineChatController } from 'vs/workbench/contrib/inlineChat/browser/inlineChatController';
import { CTX_INLINE_CHAT_FOCUSED, CTX_INLINE_CHAT_HAS_ACTIVE_REQUEST } from 'vs/workbench/contrib/inlineChat/common/inlineChat';
import { CTX_INLINE_CHAT_FOCUSED } from 'vs/workbench/contrib/inlineChat/common/inlineChat';
import { NOTEBOOK_EDITOR_FOCUSED } from 'vs/workbench/contrib/notebook/common/notebookContextKeys';
import { HasSpeechProvider, ISpeechService, KeywordRecognitionStatus, SpeechToTextInProgress, SpeechToTextStatus, TextToSpeechStatus, TextToSpeechInProgress as GlobalTextToSpeechInProgress } from 'vs/workbench/contrib/speech/common/speechService';
import { ITerminalService } from 'vs/workbench/contrib/terminal/browser/terminal';
@ -67,7 +67,7 @@ const TerminalChatExecute = MenuId.for('terminalChatInput'); // unfortunately, t
// Global Context Keys (set on global context key service)
const CanVoiceChat = ContextKeyExpr.and(CONTEXT_CHAT_ENABLED, HasSpeechProvider);
const FocusInChatInput = ContextKeyExpr.or(CTX_INLINE_CHAT_FOCUSED, CONTEXT_IN_CHAT_INPUT);
const AnyChatRequestInProgress = ContextKeyExpr.or(CONTEXT_CHAT_REQUEST_IN_PROGRESS, CTX_INLINE_CHAT_HAS_ACTIVE_REQUEST, TerminalChatContextKeys.requestActive);
const AnyChatRequestInProgress = ContextKeyExpr.or(CONTEXT_CHAT_REQUEST_IN_PROGRESS, TerminalChatContextKeys.requestActive);
// Scoped Context Keys (set on per-chat-context scoped context key service)
const ScopedVoiceChatGettingReady = new RawContextKey<boolean>('scopedVoiceChatGettingReady', false, { type: 'boolean', description: localize('scopedVoiceChatGettingReady', "True when getting ready for receiving voice input from the microphone for voice chat. This key is only defined scoped, per chat context.") });

View file

@ -11,7 +11,7 @@ import { EmbeddedDiffEditorWidget } from 'vs/editor/browser/widget/diffEditor/em
import { EmbeddedCodeEditorWidget } from 'vs/editor/browser/widget/codeEditor/embeddedCodeEditorWidget';
import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
import { InlineChatController, InlineChatRunOptions } from 'vs/workbench/contrib/inlineChat/browser/inlineChatController';
import { CTX_INLINE_CHAT_FOCUSED, CTX_INLINE_CHAT_HAS_PROVIDER, CTX_INLINE_CHAT_INNER_CURSOR_FIRST, CTX_INLINE_CHAT_INNER_CURSOR_LAST, CTX_INLINE_CHAT_OUTER_CURSOR_POSITION, CTX_INLINE_CHAT_VISIBLE, MENU_INLINE_CHAT_WIDGET_STATUS, CTX_INLINE_CHAT_EDIT_MODE, EditMode, CTX_INLINE_CHAT_DOCUMENT_CHANGED, CTX_INLINE_CHAT_HAS_STASHED_SESSION, ACTION_ACCEPT_CHANGES, CTX_INLINE_CHAT_RESPONSE_TYPES, InlineChatResponseTypes, ACTION_VIEW_IN_CHAT, CTX_INLINE_CHAT_USER_DID_EDIT, CTX_INLINE_CHAT_CHANGE_SHOWS_DIFF, CTX_INLINE_CHAT_CHANGE_HAS_DIFF, MENU_INLINE_CHAT_WIDGET, ACTION_TOGGLE_DIFF, ACTION_REGENERATE_RESPONSE } from 'vs/workbench/contrib/inlineChat/common/inlineChat';
import { CTX_INLINE_CHAT_FOCUSED, CTX_INLINE_CHAT_HAS_AGENT, CTX_INLINE_CHAT_INNER_CURSOR_FIRST, CTX_INLINE_CHAT_INNER_CURSOR_LAST, CTX_INLINE_CHAT_OUTER_CURSOR_POSITION, CTX_INLINE_CHAT_VISIBLE, MENU_INLINE_CHAT_WIDGET_STATUS, CTX_INLINE_CHAT_EDIT_MODE, EditMode, CTX_INLINE_CHAT_DOCUMENT_CHANGED, CTX_INLINE_CHAT_HAS_STASHED_SESSION, ACTION_ACCEPT_CHANGES, CTX_INLINE_CHAT_RESPONSE_TYPES, InlineChatResponseTypes, ACTION_VIEW_IN_CHAT, CTX_INLINE_CHAT_USER_DID_EDIT, CTX_INLINE_CHAT_CHANGE_SHOWS_DIFF, CTX_INLINE_CHAT_CHANGE_HAS_DIFF, MENU_INLINE_CHAT_WIDGET, ACTION_TOGGLE_DIFF, ACTION_REGENERATE_RESPONSE } from 'vs/workbench/contrib/inlineChat/common/inlineChat';
import { localize, localize2 } from 'vs/nls';
import { Action2, IAction2Options } from 'vs/platform/actions/common/actions';
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
@ -55,7 +55,7 @@ export class StartSessionAction extends EditorAction2 {
title: LOCALIZED_START_INLINE_CHAT_STRING,
category: AbstractInlineChatAction.category,
f1: true,
precondition: ContextKeyExpr.and(CTX_INLINE_CHAT_HAS_PROVIDER, EditorContextKeys.writable),
precondition: ContextKeyExpr.and(CTX_INLINE_CHAT_HAS_AGENT, EditorContextKeys.writable),
keybinding: {
when: EditorContextKeys.focus,
weight: KeybindingWeight.WorkbenchContrib,
@ -123,7 +123,7 @@ export abstract class AbstractInlineChatAction extends EditorAction2 {
super({
...desc,
category: AbstractInlineChatAction.category,
precondition: ContextKeyExpr.and(CTX_INLINE_CHAT_HAS_PROVIDER, desc.precondition)
precondition: ContextKeyExpr.and(CTX_INLINE_CHAT_HAS_AGENT, desc.precondition)
});
}

View file

@ -35,7 +35,7 @@ import { EmptyResponse, ErrorResponse, ReplyResponse, Session, SessionPrompt } f
import { IInlineChatSessionService } from './inlineChatSessionService';
import { EditModeStrategy, IEditObserver, LiveStrategy, PreviewStrategy, ProgressingEditsOptions } from 'vs/workbench/contrib/inlineChat/browser/inlineChatStrategies';
import { InlineChatZoneWidget } from './inlineChatZoneWidget';
import { CTX_INLINE_CHAT_DID_EDIT, CTX_INLINE_CHAT_LAST_FEEDBACK, CTX_INLINE_CHAT_RESPONSE_TYPES, CTX_INLINE_CHAT_SUPPORT_ISSUE_REPORTING, CTX_INLINE_CHAT_USER_DID_EDIT, CTX_INLINE_CHAT_VISIBLE, EditMode, INLINE_CHAT_ID, InlineChatConfigKeys, InlineChatResponseTypes } from 'vs/workbench/contrib/inlineChat/common/inlineChat';
import { CTX_INLINE_CHAT_RESPONSE_TYPES, CTX_INLINE_CHAT_USER_DID_EDIT, CTX_INLINE_CHAT_VISIBLE, EditMode, INLINE_CHAT_ID, InlineChatConfigKeys, InlineChatResponseTypes } from 'vs/workbench/contrib/inlineChat/common/inlineChat';
import { StashedSession } from './inlineChatSession';
import { IModelDeltaDecoration, ITextModel, IValidEditOperation } from 'vs/editor/common/model';
import { InlineChatContentWidget } from 'vs/workbench/contrib/inlineChat/browser/inlineChatContentWidget';
@ -109,10 +109,7 @@ export class InlineChatController implements IEditorContribution {
private readonly _ctxVisible: IContextKey<boolean>;
private readonly _ctxResponseTypes: IContextKey<undefined | InlineChatResponseTypes>;
private readonly _ctxDidEdit: IContextKey<boolean>;
private readonly _ctxUserDidEdit: IContextKey<boolean>;
private readonly _ctxLastFeedbackKind: IContextKey<'helpful' | 'unhelpful' | ''>;
private readonly _ctxSupportIssueReporting: IContextKey<boolean>;
private _messages = this._store.add(new Emitter<Message>());
@ -147,11 +144,8 @@ export class InlineChatController implements IEditorContribution {
@IChatWidgetService private readonly _chatWidgetService: IChatWidgetService,
) {
this._ctxVisible = CTX_INLINE_CHAT_VISIBLE.bindTo(contextKeyService);
this._ctxDidEdit = CTX_INLINE_CHAT_DID_EDIT.bindTo(contextKeyService);
this._ctxUserDidEdit = CTX_INLINE_CHAT_USER_DID_EDIT.bindTo(contextKeyService);
this._ctxResponseTypes = CTX_INLINE_CHAT_RESPONSE_TYPES.bindTo(contextKeyService);
this._ctxLastFeedbackKind = CTX_INLINE_CHAT_LAST_FEEDBACK.bindTo(contextKeyService);
this._ctxSupportIssueReporting = CTX_INLINE_CHAT_SUPPORT_ISSUE_REPORTING.bindTo(contextKeyService);
this._input = new Lazy(() => this._store.add(_instaService.createInstance(InlineChatContentWidget, this._editor)));
this._zone = new Lazy(() => this._store.add(_instaService.createInstance(InlineChatZoneWidget, this._editor)));
@ -436,9 +430,6 @@ export class InlineChatController implements IEditorContribution {
}
}));
// Update context key
this._ctxSupportIssueReporting.set(this._session.agent.metadata.supportIssueReporting ?? false);
// #region DEBT
// DEBT@jrieken
// REMOVE when agents are adopted
@ -758,7 +749,6 @@ export class InlineChatController implements IEditorContribution {
}
}
this._ctxResponseTypes.set(responseTypes);
this._ctxDidEdit.set(this._session.hasChangedText);
let newPosition: Position | undefined;
@ -908,10 +898,7 @@ export class InlineChatController implements IEditorContribution {
private _resetWidget() {
this._sessionStore.clear();
this._ctxVisible.reset();
this._ctxDidEdit.reset();
this._ctxUserDidEdit.reset();
this._ctxLastFeedbackKind.reset();
this._ctxSupportIssueReporting.reset();
this._input.rawValue?.hide();
this._zone.rawValue?.hide();
@ -949,8 +936,6 @@ export class InlineChatController implements IEditorContribution {
} else {
await this._strategy.makeChanges(editOperations, editsObserver, undoStopBefore);
}
this._ctxDidEdit.set(this._session.hasChangedText);
}
private _forcedPlaceholder: string | undefined = undefined;
@ -1051,12 +1036,6 @@ export class InlineChatController implements IEditorContribution {
this._strategy?.toggleDiff?.();
}
createSnapshot(): void {
if (this._session && !this._session.textModel0.equalsTextBuffer(this._session.textModelN.getTextBuffer())) {
this._session.createSnapshot();
}
}
acceptSession(): void {
if (this._session?.lastExchange?.response instanceof ReplyResponse && this._session?.lastExchange?.response.chatResponse) {
const response = this._session?.lastExchange?.response.chatResponse;
@ -1084,29 +1063,21 @@ export class InlineChatController implements IEditorContribution {
async cancelSession() {
let result: string | undefined;
if (this._session) {
const diff = await this._editorWorkerService.computeDiff(this._session.textModel0.uri, this._session.textModelN.uri, { ignoreTrimWhitespace: false, maxComputationTimeMs: 5000, computeMoves: false }, 'advanced');
result = this._session.asChangedText(diff?.changes ?? []);
if (this._session.lastExchange?.response instanceof ReplyResponse && this._session?.lastExchange?.response.chatResponse) {
const response = this._session?.lastExchange?.response.chatResponse;
this._chatService.notifyUserAction({
sessionId: this._session.chatModel.sessionId,
requestId: response.requestId,
agentId: response.agent?.id,
result: response.result,
action: {
kind: 'inlineChat',
action: 'discarded'
}
});
}
if (this._session?.lastExchange?.response instanceof ReplyResponse && this._session?.lastExchange?.response.chatResponse) {
const response = this._session?.lastExchange?.response.chatResponse;
this._chatService.notifyUserAction({
sessionId: this._session.chatModel.sessionId,
requestId: response.requestId,
agentId: response.agent?.id,
result: response.result,
action: {
kind: 'inlineChat',
action: 'discarded'
}
});
}
this._messages.fire(Message.CANCEL_SESSION);
return result;
}
finishExistingSession(): void {

View file

@ -144,7 +144,6 @@ export class Session {
private readonly _teldata: TelemetryData;
readonly textModelNAltVersion: number;
private _textModelNSnapshotAltVersion: number | undefined;
constructor(
readonly editMode: EditMode,
@ -200,14 +199,6 @@ export class Session {
this._isUnstashed = true;
}
get textModelNSnapshotAltVersion(): number | undefined {
return this._textModelNSnapshotAltVersion;
}
createSnapshot(): void {
this._textModelNSnapshotAltVersion = this.textModelN.getAlternativeVersionId();
}
addExchange(exchange: SessionExchange): void {
this._isUnstashed = false;
const newLen = this._exchange.push(exchange);

View file

@ -22,7 +22,7 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { DEFAULT_EDITOR_ASSOCIATION } from 'vs/workbench/common/editor';
import { ChatAgentLocation, IChatAgentService } from 'vs/workbench/contrib/chat/common/chatAgents';
import { IChatService } from 'vs/workbench/contrib/chat/common/chatService';
import { CTX_INLINE_CHAT_HAS_PROVIDER, EditMode, IInlineChatResponse, IInlineChatSession } from 'vs/workbench/contrib/inlineChat/common/inlineChat';
import { CTX_INLINE_CHAT_HAS_AGENT, EditMode, IInlineChatResponse, IInlineChatSession } from 'vs/workbench/contrib/inlineChat/common/inlineChat';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { UntitledTextEditorInput } from 'vs/workbench/services/untitled/common/untitledTextEditorInput';
import { EmptyResponse, ErrorResponse, HunkData, ReplyResponse, Session, SessionExchange, SessionWholeRange, StashedSession, TelemetryData, TelemetryDataClassification } from './inlineChatSession';
@ -417,7 +417,7 @@ export class InlineChatEnabler {
@IContextKeyService contextKeyService: IContextKeyService,
@IChatAgentService chatAgentService: IChatAgentService
) {
this._ctxHasProvider = CTX_INLINE_CHAT_HAS_PROVIDER.bindTo(contextKeyService);
this._ctxHasProvider = CTX_INLINE_CHAT_HAS_AGENT.bindTo(contextKeyService);
chatAgentService.onDidChangeAgents(() => {
const hasEditorAgent = Boolean(chatAgentService.getDefaultAgent(ChatAgentLocation.Editor));
this._ctxHasProvider.set(hasEditorAgent);

View file

@ -47,7 +47,7 @@ export const enum EditMode {
Preview = 'preview'
}
export const CTX_INLINE_CHAT_HAS_PROVIDER = new RawContextKey<boolean>('inlineChatHasProvider', false, localize('inlineChatHasProvider', "Whether a provider for interactive editors exists"));
export const CTX_INLINE_CHAT_HAS_AGENT = new RawContextKey<boolean>('inlineChatHasProvider', false, localize('inlineChatHasProvider', "Whether a provider for interactive editors exists"));
export const CTX_INLINE_CHAT_VISIBLE = new RawContextKey<boolean>('inlineChatVisible', false, localize('inlineChatVisible', "Whether the interactive editor input is visible"));
export const CTX_INLINE_CHAT_FOCUSED = new RawContextKey<boolean>('inlineChatFocused', false, localize('inlineChatFocused', "Whether the interactive editor input is focused"));
export const CTX_INLINE_CHAT_RESPONSE_FOCUSED = new RawContextKey<boolean>('inlineChatResponseFocused', false, localize('inlineChatResponseFocused', "Whether the interactive widget's response is focused"));
@ -57,13 +57,9 @@ export const CTX_INLINE_CHAT_INNER_CURSOR_LAST = new RawContextKey<boolean>('inl
export const CTX_INLINE_CHAT_INNER_CURSOR_START = new RawContextKey<boolean>('inlineChatInnerCursorStart', false, localize('inlineChatInnerCursorStart', "Whether the cursor of the iteractive editor input is on the start of the input"));
export const CTX_INLINE_CHAT_INNER_CURSOR_END = new RawContextKey<boolean>('inlineChatInnerCursorEnd', false, localize('inlineChatInnerCursorEnd', "Whether the cursor of the iteractive editor input is on the end of the input"));
export const CTX_INLINE_CHAT_OUTER_CURSOR_POSITION = new RawContextKey<'above' | 'below' | ''>('inlineChatOuterCursorPosition', '', localize('inlineChatOuterCursorPosition', "Whether the cursor of the outer editor is above or below the interactive editor input"));
export const CTX_INLINE_CHAT_HAS_ACTIVE_REQUEST = new RawContextKey<boolean>('inlineChatHasActiveRequest', false, localize('inlineChatHasActiveRequest', "Whether interactive editor has an active request"));
export const CTX_INLINE_CHAT_HAS_STASHED_SESSION = new RawContextKey<boolean>('inlineChatHasStashedSession', false, localize('inlineChatHasStashedSession', "Whether interactive editor has kept a session for quick restore"));
export const CTX_INLINE_CHAT_RESPONSE_TYPES = new RawContextKey<InlineChatResponseTypes | undefined>('inlineChatResponseTypes', InlineChatResponseTypes.Empty, localize('inlineChatResponseTypes', "What type was the responses have been receieved"));
export const CTX_INLINE_CHAT_DID_EDIT = new RawContextKey<boolean>('inlineChatDidEdit', undefined, localize('inlineChatDidEdit', "Whether interactive editor did change any code"));
export const CTX_INLINE_CHAT_USER_DID_EDIT = new RawContextKey<boolean>('inlineChatUserDidEdit', undefined, localize('inlineChatUserDidEdit', "Whether the user did changes ontop of the inline chat"));
export const CTX_INLINE_CHAT_LAST_FEEDBACK = new RawContextKey<'unhelpful' | 'helpful' | ''>('inlineChatLastFeedbackKind', '', localize('inlineChatLastFeedbackKind', "The last kind of feedback that was provided"));
export const CTX_INLINE_CHAT_SUPPORT_ISSUE_REPORTING = new RawContextKey<boolean>('inlineChatSupportIssueReporting', false, localize('inlineChatSupportIssueReporting', "Whether the interactive editor supports issue reporting"));
export const CTX_INLINE_CHAT_DOCUMENT_CHANGED = new RawContextKey<boolean>('inlineChatDocumentChanged', false, localize('inlineChatDocumentChanged', "Whether the document has changed concurrently"));
export const CTX_INLINE_CHAT_CHANGE_HAS_DIFF = new RawContextKey<boolean>('inlineChatChangeHasDiff', false, localize('inlineChatChangeHasDiff', "Whether the current change supports showing a diff"));
export const CTX_INLINE_CHAT_CHANGE_SHOWS_DIFF = new RawContextKey<boolean>('inlineChatChangeShowsDiff', false, localize('inlineChatChangeShowsDiff', "Whether the current change showing a diff"));

View file

@ -15,7 +15,7 @@ import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
import { InputFocusedContextKey } from 'vs/platform/contextkey/common/contextkeys';
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { CTX_INLINE_CHAT_FOCUSED, CTX_INLINE_CHAT_HAS_PROVIDER, CTX_INLINE_CHAT_INNER_CURSOR_FIRST, CTX_INLINE_CHAT_INNER_CURSOR_LAST, CTX_INLINE_CHAT_RESPONSE_TYPES, InlineChatResponseTypes } from 'vs/workbench/contrib/inlineChat/common/inlineChat';
import { CTX_INLINE_CHAT_FOCUSED, CTX_INLINE_CHAT_HAS_AGENT, CTX_INLINE_CHAT_INNER_CURSOR_FIRST, CTX_INLINE_CHAT_INNER_CURSOR_LAST, CTX_INLINE_CHAT_RESPONSE_TYPES, InlineChatResponseTypes } from 'vs/workbench/contrib/inlineChat/common/inlineChat';
import { CTX_NOTEBOOK_CELL_CHAT_FOCUSED, CTX_NOTEBOOK_CHAT_HAS_ACTIVE_REQUEST, CTX_NOTEBOOK_CHAT_OUTER_FOCUS_POSITION, CTX_NOTEBOOK_CHAT_USER_DID_EDIT, MENU_CELL_CHAT_INPUT, MENU_CELL_CHAT_WIDGET, MENU_CELL_CHAT_WIDGET_STATUS } from 'vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext';
import { NotebookChatController } from 'vs/workbench/contrib/notebook/browser/controller/chat/notebookChatController';
import { CELL_TITLE_CELL_GROUP_ID, INotebookActionContext, INotebookCellActionContext, NotebookAction, NotebookCellAction, getEditorFromArgsOrActivePane } from 'vs/workbench/contrib/notebook/browser/controller/coreActions';
@ -367,7 +367,7 @@ registerAction2(class extends NotebookAction {
NOTEBOOK_EDITOR_FOCUSED,
NOTEBOOK_EDITOR_EDITABLE.isEqualTo(true),
ContextKeyExpr.not(InputFocusedContextKey),
CTX_INLINE_CHAT_HAS_PROVIDER,
CTX_INLINE_CHAT_HAS_AGENT,
ContextKeyExpr.or(
ContextKeyExpr.equals(`config.${NotebookSetting.cellChat}`, true),
ContextKeyExpr.equals(`config.${NotebookSetting.cellGenerate}`, true)
@ -384,7 +384,7 @@ registerAction2(class extends NotebookAction {
order: -1,
when: ContextKeyExpr.and(
NOTEBOOK_EDITOR_EDITABLE.isEqualTo(true),
CTX_INLINE_CHAT_HAS_PROVIDER,
CTX_INLINE_CHAT_HAS_AGENT,
ContextKeyExpr.or(
ContextKeyExpr.equals(`config.${NotebookSetting.cellChat}`, true),
ContextKeyExpr.equals(`config.${NotebookSetting.cellGenerate}`, true)
@ -459,7 +459,7 @@ registerAction2(class extends NotebookAction {
order: -1,
when: ContextKeyExpr.and(
NOTEBOOK_EDITOR_EDITABLE.isEqualTo(true),
CTX_INLINE_CHAT_HAS_PROVIDER,
CTX_INLINE_CHAT_HAS_AGENT,
ContextKeyExpr.or(
ContextKeyExpr.equals(`config.${NotebookSetting.cellChat}`, true),
ContextKeyExpr.equals(`config.${NotebookSetting.cellGenerate}`, true)
@ -488,7 +488,7 @@ MenuRegistry.appendMenuItem(MenuId.NotebookToolbar, {
NOTEBOOK_EDITOR_EDITABLE.isEqualTo(true),
ContextKeyExpr.notEquals('config.notebook.insertToolbarLocation', 'betweenCells'),
ContextKeyExpr.notEquals('config.notebook.insertToolbarLocation', 'hidden'),
CTX_INLINE_CHAT_HAS_PROVIDER,
CTX_INLINE_CHAT_HAS_AGENT,
ContextKeyExpr.or(
ContextKeyExpr.equals(`config.${NotebookSetting.cellChat}`, true),
ContextKeyExpr.equals(`config.${NotebookSetting.cellGenerate}`, true)
@ -633,7 +633,7 @@ registerAction2(class extends NotebookCellAction {
order: 0,
when: ContextKeyExpr.and(
NOTEBOOK_EDITOR_EDITABLE.isEqualTo(true),
CTX_INLINE_CHAT_HAS_PROVIDER,
CTX_INLINE_CHAT_HAS_AGENT,
NOTEBOOK_CELL_GENERATED_BY_CHAT,
ContextKeyExpr.equals(`config.${NotebookSetting.cellChat}`, true)
)

View file

@ -17,7 +17,6 @@ import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { EditorsOrder } from 'vs/workbench/common/editor';
import { IDebugService } from 'vs/workbench/contrib/debug/common/debug';
import { InlineChatController } from 'vs/workbench/contrib/inlineChat/browser/inlineChatController';
import { CTX_INLINE_CHAT_FOCUSED } from 'vs/workbench/contrib/inlineChat/common/inlineChat';
import { insertCell } from 'vs/workbench/contrib/notebook/browser/controller/cellOperations';
import { CTX_NOTEBOOK_CELL_CHAT_FOCUSED } from 'vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext';
@ -105,13 +104,6 @@ async function runCell(editorGroupsService: IEditorGroupsService, context: INote
if (!foundEditor) {
return;
}
const controller = InlineChatController.get(foundEditor);
if (!controller) {
return;
}
controller.createSnapshot();
}
registerAction2(class RenderAllMarkdownCellsAction extends NotebookAction {

View file

@ -9,7 +9,7 @@ import { localize2 } from 'vs/nls';
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { AbstractInlineChatAction } from 'vs/workbench/contrib/inlineChat/browser/inlineChatActions';
import { CTX_INLINE_CHAT_EMPTY, CTX_INLINE_CHAT_FOCUSED, CTX_INLINE_CHAT_HAS_PROVIDER } from 'vs/workbench/contrib/inlineChat/common/inlineChat';
import { CTX_INLINE_CHAT_EMPTY, CTX_INLINE_CHAT_FOCUSED, CTX_INLINE_CHAT_HAS_AGENT } from 'vs/workbench/contrib/inlineChat/common/inlineChat';
import { isDetachedTerminalInstance } from 'vs/workbench/contrib/terminal/browser/terminal';
import { registerActiveXtermAction } from 'vs/workbench/contrib/terminal/browser/terminalActions';
import { TerminalContextKeys } from 'vs/workbench/contrib/terminal/common/terminalContextKey';
@ -30,7 +30,7 @@ registerActiveXtermAction({
precondition: ContextKeyExpr.and(
ContextKeyExpr.or(TerminalContextKeys.processSupported, TerminalContextKeys.terminalHasBeenCreated),
// TODO: This needs to change to check for a terminal location capable agent
CTX_INLINE_CHAT_HAS_PROVIDER
CTX_INLINE_CHAT_HAS_AGENT
),
run: (_xterm, _accessor, activeInstance, opts?: unknown) => {
if (isDetachedTerminalInstance(activeInstance)) {