renaming the content inside of inlineChat folder from IE to IC

This commit is contained in:
Aiday Marlen Kyzy 2023-06-07 16:02:34 +02:00
parent 30092f40a3
commit c529638000
No known key found for this signature in database
GPG key ID: 24A8B53DBD26FF4E
19 changed files with 390 additions and 390 deletions

View file

@ -312,15 +312,15 @@
"--vscode-inputValidation-warningBackground", "--vscode-inputValidation-warningBackground",
"--vscode-inputValidation-warningBorder", "--vscode-inputValidation-warningBorder",
"--vscode-inputValidation-warningForeground", "--vscode-inputValidation-warningForeground",
"--vscode-interactiveEditor-border", "--vscode-inlineChat-border",
"--vscode-interactiveEditor-regionHighlight", "--vscode-inlineChat-regionHighlight",
"--vscode-interactiveEditor-shadow", "--vscode-inlineChat-shadow",
"--vscode-interactiveEditorDiff-inserted", "--vscode-inlineChatDiff-inserted",
"--vscode-interactiveEditorDiff-removed", "--vscode-inlineChatDiff-removed",
"--vscode-interactiveEditorInput-background", "--vscode-inlineChatInput-background",
"--vscode-interactiveEditorInput-border", "--vscode-inlineChatInput-border",
"--vscode-interactiveEditorInput-focusBorder", "--vscode-inlineChatInput-focusBorder",
"--vscode-interactiveEditorInput-placeholderForeground", "--vscode-inlineChatInput-placeholderForeground",
"--vscode-keybindingLabel-background", "--vscode-keybindingLabel-background",
"--vscode-keybindingLabel-border", "--vscode-keybindingLabel-border",
"--vscode-keybindingLabel-bottomBorder", "--vscode-keybindingLabel-bottomBorder",

View file

@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
import { DisposableMap } from 'vs/base/common/lifecycle'; import { DisposableMap } from 'vs/base/common/lifecycle';
import { IInteractiveEditorBulkEditResponse, IInteractiveEditorResponse, IInteractiveEditorService } from 'vs/workbench/contrib/inlineChat/common/inlineChat'; import { IInlineChatBulkEditResponse, IInlineChatResponse, IInlineChatService } from 'vs/workbench/contrib/inlineChat/common/inlineChat';
import { IUriIdentityService } from 'vs/platform/uriIdentity/common/uriIdentity'; import { IUriIdentityService } from 'vs/platform/uriIdentity/common/uriIdentity';
import { reviveWorkspaceEditDto } from 'vs/workbench/api/browser/mainThreadBulkEdits'; import { reviveWorkspaceEditDto } from 'vs/workbench/api/browser/mainThreadBulkEdits';
import { ExtHostContext, ExtHostInteractiveEditorShape, MainContext, MainThreadInteractiveEditorShape } from 'vs/workbench/api/common/extHost.protocol'; import { ExtHostContext, ExtHostInteractiveEditorShape, MainContext, MainThreadInteractiveEditorShape } from 'vs/workbench/api/common/extHost.protocol';
@ -18,7 +18,7 @@ export class MainThreadInteractiveEditor implements MainThreadInteractiveEditorS
constructor( constructor(
extHostContext: IExtHostContext, extHostContext: IExtHostContext,
@IInteractiveEditorService private readonly _interactiveEditorService: IInteractiveEditorService, @IInlineChatService private readonly _inlineChatService: IInlineChatService,
@IUriIdentityService private readonly _uriIdentService: IUriIdentityService, @IUriIdentityService private readonly _uriIdentService: IUriIdentityService,
) { ) {
this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostInteractiveEditor); this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostInteractiveEditor);
@ -29,9 +29,9 @@ export class MainThreadInteractiveEditor implements MainThreadInteractiveEditorS
} }
async $registerInteractiveEditorProvider(handle: number, debugName: string, supportsFeedback: boolean): Promise<void> { async $registerInteractiveEditorProvider(handle: number, debugName: string, supportsFeedback: boolean): Promise<void> {
const unreg = this._interactiveEditorService.addProvider({ const unreg = this._inlineChatService.addProvider({
debugName, debugName,
prepareInteractiveEditorSession: async (model, range, token) => { prepareInlineChatSession: async (model, range, token) => {
const session = await this._proxy.$prepareInteractiveSession(handle, model.uri, range, token); const session = await this._proxy.$prepareInteractiveSession(handle, model.uri, range, token);
if (!session) { if (!session) {
return undefined; return undefined;
@ -46,11 +46,11 @@ export class MainThreadInteractiveEditor implements MainThreadInteractiveEditorS
provideResponse: async (item, request, token) => { provideResponse: async (item, request, token) => {
const result = await this._proxy.$provideResponse(handle, item, request, token); const result = await this._proxy.$provideResponse(handle, item, request, token);
if (result?.type === 'bulkEdit') { if (result?.type === 'bulkEdit') {
(<IInteractiveEditorBulkEditResponse>result).edits = reviveWorkspaceEditDto(result.edits, this._uriIdentService); (<IInlineChatBulkEditResponse>result).edits = reviveWorkspaceEditDto(result.edits, this._uriIdentService);
} }
return <IInteractiveEditorResponse | undefined>result; return <IInlineChatResponse | undefined>result;
}, },
handleInteractiveEditorResponseFeedback: !supportsFeedback ? undefined : async (session, response, kind) => { handleInlineChatResponseFeedback: !supportsFeedback ? undefined : async (session, response, kind) => {
this._proxy.$handleFeedback(handle, session.id, response.id, kind); this._proxy.$handleFeedback(handle, session.id, response.id, kind);
} }
}); });

View file

@ -26,7 +26,7 @@ import * as languages from 'vs/editor/common/languages';
import { CharacterPair, CommentRule, EnterAction } from 'vs/editor/common/languages/languageConfiguration'; import { CharacterPair, CommentRule, EnterAction } from 'vs/editor/common/languages/languageConfiguration';
import { EndOfLineSequence } from 'vs/editor/common/model'; import { EndOfLineSequence } from 'vs/editor/common/model';
import { IModelChangedEvent } from 'vs/editor/common/model/mirrorTextModel'; import { IModelChangedEvent } from 'vs/editor/common/model/mirrorTextModel';
import { IInteractiveEditorRequest, IInteractiveEditorResponse, IInteractiveEditorSession, InteractiveEditorResponseFeedbackKind } from 'vs/workbench/contrib/inlineChat/common/inlineChat'; import { IInlineChatRequest, IInlineChatResponse, IInlineChatSession, InlineChatResponseFeedbackKind } from 'vs/workbench/contrib/inlineChat/common/inlineChat';
import { IAccessibilityInformation } from 'vs/platform/accessibility/common/accessibility'; import { IAccessibilityInformation } from 'vs/platform/accessibility/common/accessibility';
import { ConfigurationTarget, IConfigurationChange, IConfigurationData, IConfigurationOverrides } from 'vs/platform/configuration/common/configuration'; import { ConfigurationTarget, IConfigurationChange, IConfigurationData, IConfigurationOverrides } from 'vs/platform/configuration/common/configuration';
import { ConfigurationScope } from 'vs/platform/configuration/common/configurationRegistry'; import { ConfigurationScope } from 'vs/platform/configuration/common/configurationRegistry';
@ -1120,12 +1120,12 @@ export interface MainThreadInteractiveEditorShape extends IDisposable {
$unregisterInteractiveEditorProvider(handle: number): Promise<void>; $unregisterInteractiveEditorProvider(handle: number): Promise<void>;
} }
export type IInteractiveEditorResponseDto = Dto<IInteractiveEditorResponse>; export type IInteractiveEditorResponseDto = Dto<IInlineChatResponse>;
export interface ExtHostInteractiveEditorShape { export interface ExtHostInteractiveEditorShape {
$prepareInteractiveSession(handle: number, uri: UriComponents, range: ISelection, token: CancellationToken): Promise<IInteractiveEditorSession | undefined>; $prepareInteractiveSession(handle: number, uri: UriComponents, range: ISelection, token: CancellationToken): Promise<IInlineChatSession | undefined>;
$provideResponse(handle: number, session: IInteractiveEditorSession, request: IInteractiveEditorRequest, token: CancellationToken): Promise<IInteractiveEditorResponseDto | undefined>; $provideResponse(handle: number, session: IInlineChatSession, request: IInlineChatRequest, token: CancellationToken): Promise<IInteractiveEditorResponseDto | undefined>;
$handleFeedback(handle: number, sessionId: number, responseId: number, kind: InteractiveEditorResponseFeedbackKind): void; $handleFeedback(handle: number, sessionId: number, responseId: number, kind: InlineChatResponseFeedbackKind): void;
$releaseSession(handle: number, sessionId: number): void; $releaseSession(handle: number, sessionId: number): void;
} }

View file

@ -7,7 +7,7 @@ import { CancellationToken } from 'vs/base/common/cancellation';
import { toDisposable } from 'vs/base/common/lifecycle'; import { toDisposable } from 'vs/base/common/lifecycle';
import { URI, UriComponents } from 'vs/base/common/uri'; import { URI, UriComponents } from 'vs/base/common/uri';
import { ISelection } from 'vs/editor/common/core/selection'; import { ISelection } from 'vs/editor/common/core/selection';
import { IInteractiveEditorSession, IInteractiveEditorRequest, InteractiveEditorResponseFeedbackKind, InteractiveEditorResponseType } from 'vs/workbench/contrib/inlineChat/common/inlineChat'; import { IInlineChatSession, IInlineChatRequest, InlineChatResponseFeedbackKind, InlineChatResponseType } from 'vs/workbench/contrib/inlineChat/common/inlineChat';
import { IRelaxedExtensionDescription } from 'vs/platform/extensions/common/extensions'; import { IRelaxedExtensionDescription } from 'vs/platform/extensions/common/extensions';
import { ILogService } from 'vs/platform/log/common/log'; import { ILogService } from 'vs/platform/log/common/log';
import { ExtHostInteractiveEditorShape, IInteractiveEditorResponseDto, IMainContext, MainContext, MainThreadInteractiveEditorShape } from 'vs/workbench/api/common/extHost.protocol'; import { ExtHostInteractiveEditorShape, IInteractiveEditorResponseDto, IMainContext, MainContext, MainThreadInteractiveEditorShape } from 'vs/workbench/api/common/extHost.protocol';
@ -95,7 +95,7 @@ export class ExtHostInteractiveEditor implements ExtHostInteractiveEditorShape {
}); });
} }
async $prepareInteractiveSession(handle: number, uri: UriComponents, range: ISelection, token: CancellationToken): Promise<IInteractiveEditorSession | undefined> { async $prepareInteractiveSession(handle: number, uri: UriComponents, range: ISelection, token: CancellationToken): Promise<IInlineChatSession | undefined> {
const entry = this._inputProvider.get(handle); const entry = this._inputProvider.get(handle);
if (!entry) { if (!entry) {
this._logService.warn('CANNOT prepare session because the PROVIDER IS GONE'); this._logService.warn('CANNOT prepare session because the PROVIDER IS GONE');
@ -125,7 +125,7 @@ export class ExtHostInteractiveEditor implements ExtHostInteractiveEditorShape {
}; };
} }
async $provideResponse(handle: number, item: IInteractiveEditorSession, request: IInteractiveEditorRequest, token: CancellationToken): Promise<IInteractiveEditorResponseDto | undefined> { async $provideResponse(handle: number, item: IInlineChatSession, request: IInlineChatRequest, token: CancellationToken): Promise<IInteractiveEditorResponseDto | undefined> {
const entry = this._inputProvider.get(handle); const entry = this._inputProvider.get(handle);
if (!entry) { if (!entry) {
return undefined; return undefined;
@ -156,7 +156,7 @@ export class ExtHostInteractiveEditor implements ExtHostInteractiveEditorShape {
return { return {
...stub, ...stub,
id, id,
type: InteractiveEditorResponseType.Message, type: InlineChatResponseType.Message,
message: typeConvert.MarkdownString.from(res.contents), message: typeConvert.MarkdownString.from(res.contents),
}; };
} }
@ -166,7 +166,7 @@ export class ExtHostInteractiveEditor implements ExtHostInteractiveEditorShape {
return { return {
...stub, ...stub,
id, id,
type: InteractiveEditorResponseType.BulkEdit, type: InlineChatResponseType.BulkEdit,
edits: typeConvert.WorkspaceEdit.from(edits), edits: typeConvert.WorkspaceEdit.from(edits),
}; };
@ -174,7 +174,7 @@ export class ExtHostInteractiveEditor implements ExtHostInteractiveEditorShape {
return { return {
...stub, ...stub,
id, id,
type: InteractiveEditorResponseType.EditorEdit, type: InlineChatResponseType.EditorEdit,
edits: edits.map(typeConvert.TextEdit.from), edits: edits.map(typeConvert.TextEdit.from),
}; };
} }
@ -183,7 +183,7 @@ export class ExtHostInteractiveEditor implements ExtHostInteractiveEditorShape {
return undefined; return undefined;
} }
$handleFeedback(handle: number, sessionId: number, responseId: number, kind: InteractiveEditorResponseFeedbackKind): void { $handleFeedback(handle: number, sessionId: number, responseId: number, kind: InlineChatResponseFeedbackKind): void {
const entry = this._inputProvider.get(handle); const entry = this._inputProvider.get(handle);
const sessionData = this._inputSessions.get(sessionId); const sessionData = this._inputSessions.get(sessionId);
const response = sessionData?.responses[responseId]; const response = sessionData?.responses[responseId];
@ -192,13 +192,13 @@ export class ExtHostInteractiveEditor implements ExtHostInteractiveEditorShape {
// todo@jrieken move to type converter // todo@jrieken move to type converter
let apiKind: extHostTypes.InteractiveEditorResponseFeedbackKind; let apiKind: extHostTypes.InteractiveEditorResponseFeedbackKind;
switch (kind) { switch (kind) {
case InteractiveEditorResponseFeedbackKind.Helpful: case InlineChatResponseFeedbackKind.Helpful:
apiKind = extHostTypes.InteractiveEditorResponseFeedbackKind.Helpful; apiKind = extHostTypes.InteractiveEditorResponseFeedbackKind.Helpful;
break; break;
case InteractiveEditorResponseFeedbackKind.Unhelpful: case InlineChatResponseFeedbackKind.Unhelpful:
apiKind = extHostTypes.InteractiveEditorResponseFeedbackKind.Unhelpful; apiKind = extHostTypes.InteractiveEditorResponseFeedbackKind.Unhelpful;
break; break;
case InteractiveEditorResponseFeedbackKind.Undone: case InlineChatResponseFeedbackKind.Undone:
apiKind = extHostTypes.InteractiveEditorResponseFeedbackKind.Undone; apiKind = extHostTypes.InteractiveEditorResponseFeedbackKind.Undone;
break; break;
} }

View file

@ -5,48 +5,48 @@
import { registerAction2 } from 'vs/platform/actions/common/actions'; import { registerAction2 } from 'vs/platform/actions/common/actions';
import { EditorContributionInstantiation, registerEditorContribution } from 'vs/editor/browser/editorExtensions'; import { EditorContributionInstantiation, registerEditorContribution } from 'vs/editor/browser/editorExtensions';
import { InteractiveEditorController } from 'vs/workbench/contrib/inlineChat/browser/inlineChatController'; import { InlineChatController } from 'vs/workbench/contrib/inlineChat/browser/inlineChatController';
import * as interactiveEditorActions from 'vs/workbench/contrib/inlineChat/browser/inlineChatActions'; import * as InlineChatActions from 'vs/workbench/contrib/inlineChat/browser/inlineChatActions';
import { IInteractiveEditorService, INTERACTIVE_EDITOR_ID } from 'vs/workbench/contrib/inlineChat/common/inlineChat'; import { IInlineChatService, INLINE_CHAT_ID } from 'vs/workbench/contrib/inlineChat/common/inlineChat';
import { InstantiationType, registerSingleton } from 'vs/platform/instantiation/common/extensions'; import { InstantiationType, registerSingleton } from 'vs/platform/instantiation/common/extensions';
import { InteractiveEditorServiceImpl } from 'vs/workbench/contrib/inlineChat/common/inlineChatServiceImpl'; import { InlineChatServiceImpl } from 'vs/workbench/contrib/inlineChat/common/inlineChatServiceImpl';
import { IInteractiveEditorSessionService, InteractiveEditorSessionService } from 'vs/workbench/contrib/inlineChat/browser/inlineChatSession'; import { IInlineChatSessionService, InlineChatSessionService } from 'vs/workbench/contrib/inlineChat/browser/inlineChatSession';
import { Registry } from 'vs/platform/registry/common/platform'; import { Registry } from 'vs/platform/registry/common/platform';
import { IWorkbenchContributionsRegistry, Extensions } from 'vs/workbench/common/contributions'; import { IWorkbenchContributionsRegistry, Extensions } from 'vs/workbench/common/contributions';
import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle'; import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle';
import { InteractiveEditorNotebookContribution } from 'vs/workbench/contrib/inlineChat/browser/inlineChatNotebook'; import { InlineChatNotebookContribution } from 'vs/workbench/contrib/inlineChat/browser/inlineChatNotebook';
registerSingleton(IInteractiveEditorService, InteractiveEditorServiceImpl, InstantiationType.Delayed); registerSingleton(IInlineChatService, InlineChatServiceImpl, InstantiationType.Delayed);
registerSingleton(IInteractiveEditorSessionService, InteractiveEditorSessionService, InstantiationType.Delayed); registerSingleton(IInlineChatSessionService, InlineChatSessionService, InstantiationType.Delayed);
registerEditorContribution(INTERACTIVE_EDITOR_ID, InteractiveEditorController, EditorContributionInstantiation.Eager); // EAGER because of notebook dispose/create of editors registerEditorContribution(INLINE_CHAT_ID, InlineChatController, EditorContributionInstantiation.Eager); // EAGER because of notebook dispose/create of editors
registerAction2(interactiveEditorActions.StartSessionAction); registerAction2(InlineChatActions.StartSessionAction);
registerAction2(interactiveEditorActions.UnstashSessionAction); registerAction2(InlineChatActions.UnstashSessionAction);
registerAction2(interactiveEditorActions.MakeRequestAction); registerAction2(InlineChatActions.MakeRequestAction);
registerAction2(interactiveEditorActions.StopRequestAction); registerAction2(InlineChatActions.StopRequestAction);
registerAction2(interactiveEditorActions.DiscardAction); registerAction2(InlineChatActions.DiscardAction);
registerAction2(interactiveEditorActions.DiscardToClipboardAction); registerAction2(InlineChatActions.DiscardToClipboardAction);
registerAction2(interactiveEditorActions.DiscardUndoToNewFileAction); registerAction2(InlineChatActions.DiscardUndoToNewFileAction);
registerAction2(interactiveEditorActions.CancelSessionAction); registerAction2(InlineChatActions.CancelSessionAction);
registerAction2(interactiveEditorActions.ArrowOutUpAction); registerAction2(InlineChatActions.ArrowOutUpAction);
registerAction2(interactiveEditorActions.ArrowOutDownAction); registerAction2(InlineChatActions.ArrowOutDownAction);
registerAction2(interactiveEditorActions.FocusInteractiveEditor); registerAction2(InlineChatActions.FocusInlineChat);
registerAction2(interactiveEditorActions.PreviousFromHistory); registerAction2(InlineChatActions.PreviousFromHistory);
registerAction2(interactiveEditorActions.NextFromHistory); registerAction2(InlineChatActions.NextFromHistory);
registerAction2(interactiveEditorActions.ViewInChatAction); registerAction2(InlineChatActions.ViewInChatAction);
registerAction2(interactiveEditorActions.ExpandMessageAction); registerAction2(InlineChatActions.ExpandMessageAction);
registerAction2(interactiveEditorActions.ContractMessageAction); registerAction2(InlineChatActions.ContractMessageAction);
registerAction2(interactiveEditorActions.AccessibilityHelpEditorAction); registerAction2(InlineChatActions.AccessibilityHelpEditorAction);
registerAction2(interactiveEditorActions.ToggleInlineDiff); registerAction2(InlineChatActions.ToggleInlineDiff);
registerAction2(interactiveEditorActions.FeebackHelpfulCommand); registerAction2(InlineChatActions.FeebackHelpfulCommand);
registerAction2(interactiveEditorActions.FeebackUnhelpfulCommand); registerAction2(InlineChatActions.FeebackUnhelpfulCommand);
registerAction2(interactiveEditorActions.ApplyPreviewEdits); registerAction2(InlineChatActions.ApplyPreviewEdits);
registerAction2(interactiveEditorActions.CopyRecordings); registerAction2(InlineChatActions.CopyRecordings);
Registry.as<IWorkbenchContributionsRegistry>(Extensions.Workbench) Registry.as<IWorkbenchContributionsRegistry>(Extensions.Workbench)
.registerWorkbenchContribution(InteractiveEditorNotebookContribution, LifecyclePhase.Restored); .registerWorkbenchContribution(InlineChatNotebookContribution, LifecyclePhase.Restored);

View file

@ -11,8 +11,8 @@
color: inherit; color: inherit;
padding: 6px; padding: 6px;
border-radius: 6px; border-radius: 6px;
border: 1px solid var(--vscode-interactiveEditor-border); border: 1px solid var(--vscode-inlineChat-border);
box-shadow: 0 4px 8px var(--vscode-interactiveEditor-shadow); box-shadow: 0 4px 8px var(--vscode-inlineChat-shadow);
} }
/* body */ /* body */
@ -25,30 +25,30 @@
display: flex; display: flex;
box-sizing: border-box; box-sizing: border-box;
border-radius: 2px; border-radius: 2px;
border: 1px solid var(--vscode-interactiveEditorInput-border); border: 1px solid var(--vscode-inlineChatInput-border);
} }
.monaco-editor .interactive-editor .body .content.synthetic-focus { .monaco-editor .interactive-editor .body .content.synthetic-focus {
outline: 1px solid var(--vscode-interactiveEditorInput-focusBorder); outline: 1px solid var(--vscode-inlineChatInput-focusBorder);
} }
.monaco-editor .interactive-editor .body .content .input { .monaco-editor .interactive-editor .body .content .input {
padding: 2px 2px 2px 4px; padding: 2px 2px 2px 4px;
border-top-left-radius: 2px; border-top-left-radius: 2px;
border-bottom-left-radius: 2px; border-bottom-left-radius: 2px;
background-color: var(--vscode-interactiveEditorInput-background); background-color: var(--vscode-inlineChatInput-background);
cursor: text; cursor: text;
} }
.monaco-editor .interactive-editor .body .content .input .monaco-editor-background { .monaco-editor .interactive-editor .body .content .input .monaco-editor-background {
background-color: var(--vscode-interactiveEditorInput-background); background-color: var(--vscode-inlineChatInput-background);
} }
.monaco-editor .interactive-editor .body .content .input .editor-placeholder { .monaco-editor .interactive-editor .body .content .input .editor-placeholder {
position: absolute; position: absolute;
z-index: 1; z-index: 1;
padding: 3px 0 0 0; padding: 3px 0 0 0;
color: var(--vscode-interactiveEditorInput-placeholderForeground); color: var(--vscode-inlineChatInput-placeholderForeground);
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
@ -68,7 +68,7 @@
padding-right: 4px; padding-right: 4px;
border-top-right-radius: 2px; border-top-right-radius: 2px;
border-bottom-right-radius: 2px; border-bottom-right-radius: 2px;
background: var(--vscode-interactiveEditorInput-background); background: var(--vscode-inlineChatInput-background);
} }
.monaco-editor .interactive-editor .body .toolbar .actions-container { .monaco-editor .interactive-editor .body .toolbar .actions-container {
@ -215,7 +215,7 @@
.monaco-editor .interactive-editor .previewDiff { .monaco-editor .interactive-editor .previewDiff {
display: inherit; display: inherit;
padding: 6px; padding: 6px;
border: 1px solid var(--vscode-interactiveEditor-border); border: 1px solid var(--vscode-inlineChat-border);
border-top: none; border-top: none;
border-bottom-left-radius: 2px; border-bottom-left-radius: 2px;
border-bottom-right-radius: 2px; border-bottom-right-radius: 2px;
@ -229,7 +229,7 @@
.monaco-editor .interactive-editor .previewCreate { .monaco-editor .interactive-editor .previewCreate {
display: inherit; display: inherit;
padding: 6px; padding: 6px;
border: 1px solid var(--vscode-interactiveEditor-border); border: 1px solid var(--vscode-inlineChat-border);
border-radius: 2px; border-radius: 2px;
margin: 0 2px 6px 2px; margin: 0 2px 6px 2px;
} }
@ -252,7 +252,7 @@
} }
.monaco-editor .interactive-editor-block-selection { .monaco-editor .interactive-editor-block-selection {
background-color: var(--vscode-interactiveEditor-regionHighlight); background-color: var(--vscode-inlineChat-regionHighlight);
} }
.monaco-editor .interactive-editor-slash-command { .monaco-editor .interactive-editor-slash-command {
@ -271,14 +271,14 @@
.monaco-editor .interactive-editor-diff-widget .monaco-diff-editor .monaco-editor-background, .monaco-editor .interactive-editor-diff-widget .monaco-diff-editor .monaco-editor-background,
.monaco-editor .interactive-editor-diff-widget .monaco-diff-editor .monaco-editor .margin-view-overlays { .monaco-editor .interactive-editor-diff-widget .monaco-diff-editor .monaco-editor .margin-view-overlays {
background-color: var(--vscode-interactiveEditor-regionHighlight); background-color: var(--vscode-inlineChat-regionHighlight);
} }
/* create zone */ /* create zone */
.monaco-editor .interactive-editor-newfile-widget { .monaco-editor .interactive-editor-newfile-widget {
padding: 3px 0 6px 0; padding: 3px 0 6px 0;
background-color: var(--vscode-interactiveEditor-regionHighlight); background-color: var(--vscode-inlineChat-regionHighlight);
} }
.monaco-editor .interactive-editor-newfile-widget .title { .monaco-editor .interactive-editor-newfile-widget .title {

View file

@ -9,8 +9,8 @@ import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { EditorAction2 } from 'vs/editor/browser/editorExtensions'; import { EditorAction2 } from 'vs/editor/browser/editorExtensions';
import { EmbeddedCodeEditorWidget, EmbeddedDiffEditorWidget } from 'vs/editor/browser/widget/embeddedCodeEditorWidget'; import { EmbeddedCodeEditorWidget, EmbeddedDiffEditorWidget } from 'vs/editor/browser/widget/embeddedCodeEditorWidget';
import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
import { InteractiveEditorController, InteractiveEditorRunOptions } from 'vs/workbench/contrib/inlineChat/browser/inlineChatController'; import { InlineChatController, InlineChatRunOptions } from 'vs/workbench/contrib/inlineChat/browser/inlineChatController';
import { CTX_INTERACTIVE_EDITOR_FOCUSED, CTX_INTERACTIVE_EDITOR_HAS_ACTIVE_REQUEST, CTX_INTERACTIVE_EDITOR_HAS_PROVIDER, CTX_INTERACTIVE_EDITOR_INNER_CURSOR_FIRST, CTX_INTERACTIVE_EDITOR_INNER_CURSOR_LAST, CTX_INTERACTIVE_EDITOR_EMPTY, CTX_INTERACTIVE_EDITOR_OUTER_CURSOR_POSITION, CTX_INTERACTIVE_EDITOR_VISIBLE, MENU_INTERACTIVE_EDITOR_WIDGET, MENU_INTERACTIVE_EDITOR_WIDGET_DISCARD, MENU_INTERACTIVE_EDITOR_WIDGET_STATUS, CTX_INTERACTIVE_EDITOR_LAST_FEEDBACK, CTX_INTERACTIVE_EDITOR_SHOWING_DIFF, CTX_INTERACTIVE_EDITOR_EDIT_MODE, EditMode, CTX_INTERACTIVE_EDITOR_LAST_RESPONSE_TYPE, MENU_INTERACTIVE_EDITOR_WIDGET_MARKDOWN_MESSAGE, CTX_INTERACTIVE_EDITOR_MESSAGE_CROP_STATE, CTX_INTERACTIVE_EDITOR_DOCUMENT_CHANGED, CTX_INTERACTIVE_EDITOR_DID_EDIT, CTX_INTERACTIVE_EDITOR_HAS_STASHED_SESSION, MENU_INTERACTIVE_EDITOR_WIDGET_FEEDBACK, ACTION_ACCEPT_CHANGES } from 'vs/workbench/contrib/inlineChat/common/inlineChat'; import { CTX_INLINE_CHAT_FOCUSED, CTX_INLINE_CHAT_HAS_ACTIVE_REQUEST, CTX_INLINE_CHAT_HAS_PROVIDER, CTX_INLINE_CHAT_INNER_CURSOR_FIRST, CTX_INLINE_CHAT_INNER_CURSOR_LAST, CTX_INLINE_CHAT_EMPTY, CTX_INLINE_CHAT_OUTER_CURSOR_POSITION, CTX_INLINE_CHAT_VISIBLE, MENU_INLINE_CHAT_WIDGET, MENU_INLINE_CHAT_WIDGET_DISCARD, MENU_INLINE_CHAT_WIDGET_STATUS, CTX_INLINE_CHAT_LAST_FEEDBACK, CTX_INLINE_CHAT_SHOWING_DIFF, CTX_INLINE_CHAT_EDIT_MODE, EditMode, CTX_INLINE_CHAT_LAST_RESPONSE_TYPE, MENU_INLINE_CHAT_WIDGET_MARKDOWN_MESSAGE, CTX_INLINE_CHAT_MESSAGE_CROP_STATE, CTX_INLINE_CHAT_DOCUMENT_CHANGED, CTX_INLINE_CHAT_DID_EDIT, CTX_INLINE_CHAT_HAS_STASHED_SESSION, MENU_INLINE_CHAT_WIDGET_FEEDBACK, ACTION_ACCEPT_CHANGES } from 'vs/workbench/contrib/inlineChat/common/inlineChat';
import { localize } from 'vs/nls'; import { localize } from 'vs/nls';
import { IAction2Options, MenuRegistry } from 'vs/platform/actions/common/actions'; import { IAction2Options, MenuRegistry } from 'vs/platform/actions/common/actions';
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService'; import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
@ -23,7 +23,7 @@ import { IUntitledTextResourceEditorInput } from 'vs/workbench/common/editor';
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService'; import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
import { Range } from 'vs/editor/common/core/range'; import { Range } from 'vs/editor/common/core/range';
import { fromNow } from 'vs/base/common/date'; import { fromNow } from 'vs/base/common/date';
import { IInteractiveEditorSessionService, Recording } from 'vs/workbench/contrib/inlineChat/browser/inlineChatSession'; import { IInlineChatSessionService, Recording } from 'vs/workbench/contrib/inlineChat/browser/inlineChatSession';
import { runAccessibilityHelpAction } from 'vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp'; import { runAccessibilityHelpAction } from 'vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp';
import { CONTEXT_ACCESSIBILITY_MODE_ENABLED } from 'vs/platform/accessibility/common/accessibility'; import { CONTEXT_ACCESSIBILITY_MODE_ENABLED } from 'vs/platform/accessibility/common/accessibility';
@ -34,9 +34,9 @@ export class StartSessionAction extends EditorAction2 {
super({ super({
id: 'interactiveEditor.start', id: 'interactiveEditor.start',
title: { value: localize('run', 'Start Code Chat'), original: 'Start Code Chat' }, title: { value: localize('run', 'Start Code Chat'), original: 'Start Code Chat' },
category: AbstractInteractiveEditorAction.category, category: AbstractInlineChatAction.category,
f1: true, f1: true,
precondition: ContextKeyExpr.and(CTX_INTERACTIVE_EDITOR_HAS_PROVIDER, EditorContextKeys.writable), precondition: ContextKeyExpr.and(CTX_INLINE_CHAT_HAS_PROVIDER, EditorContextKeys.writable),
keybinding: { keybinding: {
weight: KeybindingWeight.WorkbenchContrib, weight: KeybindingWeight.WorkbenchContrib,
primary: KeyMod.CtrlCmd | KeyCode.KeyI, primary: KeyMod.CtrlCmd | KeyCode.KeyI,
@ -45,7 +45,7 @@ export class StartSessionAction extends EditorAction2 {
}); });
} }
private _isInteractivEditorOptions(options: any): options is InteractiveEditorRunOptions { private _isInteractivEditorOptions(options: any): options is InlineChatRunOptions {
const { initialRange, message, autoSend } = options; const { initialRange, message, autoSend } = options;
if ( if (
typeof message !== 'undefined' && typeof message !== 'string' typeof message !== 'undefined' && typeof message !== 'string'
@ -57,12 +57,12 @@ export class StartSessionAction extends EditorAction2 {
} }
override runEditorCommand(_accessor: ServicesAccessor, editor: ICodeEditor, ..._args: any[]) { override runEditorCommand(_accessor: ServicesAccessor, editor: ICodeEditor, ..._args: any[]) {
let options: InteractiveEditorRunOptions | undefined; let options: InlineChatRunOptions | undefined;
const arg = _args[0]; const arg = _args[0];
if (arg && this._isInteractivEditorOptions(arg)) { if (arg && this._isInteractivEditorOptions(arg)) {
options = arg; options = arg;
} }
InteractiveEditorController.get(editor)?.run(options); InlineChatController.get(editor)?.run(options);
} }
} }
@ -71,8 +71,8 @@ export class UnstashSessionAction extends EditorAction2 {
super({ super({
id: 'interactiveEditor.unstash', id: 'interactiveEditor.unstash',
title: { value: localize('unstash', 'Resume Last Dismissed Code Chat'), original: 'Resume Last Dismissed Code Chat' }, title: { value: localize('unstash', 'Resume Last Dismissed Code Chat'), original: 'Resume Last Dismissed Code Chat' },
category: AbstractInteractiveEditorAction.category, category: AbstractInlineChatAction.category,
precondition: ContextKeyExpr.and(CTX_INTERACTIVE_EDITOR_HAS_STASHED_SESSION, EditorContextKeys.writable), precondition: ContextKeyExpr.and(CTX_INLINE_CHAT_HAS_STASHED_SESSION, EditorContextKeys.writable),
keybinding: { keybinding: {
weight: KeybindingWeight.WorkbenchContrib, weight: KeybindingWeight.WorkbenchContrib,
primary: KeyMod.CtrlCmd | KeyCode.KeyZ, primary: KeyMod.CtrlCmd | KeyCode.KeyZ,
@ -81,7 +81,7 @@ export class UnstashSessionAction extends EditorAction2 {
} }
override runEditorCommand(_accessor: ServicesAccessor, editor: ICodeEditor, ..._args: any[]) { override runEditorCommand(_accessor: ServicesAccessor, editor: ICodeEditor, ..._args: any[]) {
const ctrl = InteractiveEditorController.get(editor); const ctrl = InlineChatController.get(editor);
if (ctrl) { if (ctrl) {
const session = ctrl.unstashLastSession(); const session = ctrl.unstashLastSession();
if (session) { if (session) {
@ -94,15 +94,15 @@ export class UnstashSessionAction extends EditorAction2 {
} }
} }
abstract class AbstractInteractiveEditorAction extends EditorAction2 { abstract class AbstractInlineChatAction extends EditorAction2 {
static readonly category = { value: localize('cat', 'Interactive Editor'), original: 'Interactive Editor' }; static readonly category = { value: localize('cat', 'Interactive Editor'), original: 'Interactive Editor' };
constructor(desc: IAction2Options) { constructor(desc: IAction2Options) {
super({ super({
...desc, ...desc,
category: AbstractInteractiveEditorAction.category, category: AbstractInlineChatAction.category,
precondition: ContextKeyExpr.and(CTX_INTERACTIVE_EDITOR_HAS_PROVIDER, desc.precondition) precondition: ContextKeyExpr.and(CTX_INLINE_CHAT_HAS_PROVIDER, desc.precondition)
}); });
} }
@ -110,7 +110,7 @@ abstract class AbstractInteractiveEditorAction extends EditorAction2 {
if (editor instanceof EmbeddedCodeEditorWidget) { if (editor instanceof EmbeddedCodeEditorWidget) {
editor = editor.getParentEditor(); editor = editor.getParentEditor();
} }
const ctrl = InteractiveEditorController.get(editor); const ctrl = InlineChatController.get(editor);
if (!ctrl) { if (!ctrl) {
for (const diffEditor of accessor.get(ICodeEditorService).listDiffEditors()) { for (const diffEditor of accessor.get(ICodeEditorService).listDiffEditors()) {
if (diffEditor.getOriginalEditor() === editor || diffEditor.getModifiedEditor() === editor) { if (diffEditor.getOriginalEditor() === editor || diffEditor.getModifiedEditor() === editor) {
@ -121,53 +121,53 @@ abstract class AbstractInteractiveEditorAction extends EditorAction2 {
} }
return; return;
} }
this.runInteractiveEditorCommand(accessor, ctrl, editor, ..._args); this.runInlineChatCommand(accessor, ctrl, editor, ..._args);
} }
abstract runInteractiveEditorCommand(accessor: ServicesAccessor, ctrl: InteractiveEditorController, editor: ICodeEditor, ...args: any[]): void; abstract runInlineChatCommand(accessor: ServicesAccessor, ctrl: InlineChatController, editor: ICodeEditor, ...args: any[]): void;
} }
export class MakeRequestAction extends AbstractInteractiveEditorAction { export class MakeRequestAction extends AbstractInlineChatAction {
constructor() { constructor() {
super({ super({
id: 'interactiveEditor.accept', id: 'interactiveEditor.accept',
title: localize('accept', 'Make Request'), title: localize('accept', 'Make Request'),
icon: Codicon.send, icon: Codicon.send,
precondition: ContextKeyExpr.and(CTX_INTERACTIVE_EDITOR_VISIBLE, CTX_INTERACTIVE_EDITOR_EMPTY.negate()), precondition: ContextKeyExpr.and(CTX_INLINE_CHAT_VISIBLE, CTX_INLINE_CHAT_EMPTY.negate()),
keybinding: { keybinding: {
when: CTX_INTERACTIVE_EDITOR_FOCUSED, when: CTX_INLINE_CHAT_FOCUSED,
weight: KeybindingWeight.EditorCore + 7, weight: KeybindingWeight.EditorCore + 7,
primary: KeyCode.Enter primary: KeyCode.Enter
}, },
menu: { menu: {
id: MENU_INTERACTIVE_EDITOR_WIDGET, id: MENU_INLINE_CHAT_WIDGET,
group: 'main', group: 'main',
order: 1, order: 1,
when: CTX_INTERACTIVE_EDITOR_HAS_ACTIVE_REQUEST.isEqualTo(false) when: CTX_INLINE_CHAT_HAS_ACTIVE_REQUEST.isEqualTo(false)
} }
}); });
} }
runInteractiveEditorCommand(_accessor: ServicesAccessor, ctrl: InteractiveEditorController, _editor: ICodeEditor, ..._args: any[]): void { runInlineChatCommand(_accessor: ServicesAccessor, ctrl: InlineChatController, _editor: ICodeEditor, ..._args: any[]): void {
ctrl.acceptInput(); ctrl.acceptInput();
} }
} }
export class StopRequestAction extends AbstractInteractiveEditorAction { export class StopRequestAction extends AbstractInlineChatAction {
constructor() { constructor() {
super({ super({
id: 'interactiveEditor.stop', id: 'interactiveEditor.stop',
title: localize('stop', 'Stop Request'), title: localize('stop', 'Stop Request'),
icon: Codicon.debugStop, icon: Codicon.debugStop,
precondition: ContextKeyExpr.and(CTX_INTERACTIVE_EDITOR_VISIBLE, CTX_INTERACTIVE_EDITOR_EMPTY.negate(), CTX_INTERACTIVE_EDITOR_HAS_ACTIVE_REQUEST), precondition: ContextKeyExpr.and(CTX_INLINE_CHAT_VISIBLE, CTX_INLINE_CHAT_EMPTY.negate(), CTX_INLINE_CHAT_HAS_ACTIVE_REQUEST),
menu: { menu: {
id: MENU_INTERACTIVE_EDITOR_WIDGET, id: MENU_INLINE_CHAT_WIDGET,
group: 'main', group: 'main',
order: 1, order: 1,
when: CTX_INTERACTIVE_EDITOR_HAS_ACTIVE_REQUEST when: CTX_INLINE_CHAT_HAS_ACTIVE_REQUEST
}, },
keybinding: { keybinding: {
weight: KeybindingWeight.EditorContrib, weight: KeybindingWeight.EditorContrib,
@ -176,17 +176,17 @@ export class StopRequestAction extends AbstractInteractiveEditorAction {
}); });
} }
runInteractiveEditorCommand(_accessor: ServicesAccessor, ctrl: InteractiveEditorController, _editor: ICodeEditor, ..._args: any[]): void { runInlineChatCommand(_accessor: ServicesAccessor, ctrl: InlineChatController, _editor: ICodeEditor, ..._args: any[]): void {
ctrl.cancelCurrentRequest(); ctrl.cancelCurrentRequest();
} }
} }
export class ArrowOutUpAction extends AbstractInteractiveEditorAction { export class ArrowOutUpAction extends AbstractInlineChatAction {
constructor() { constructor() {
super({ super({
id: 'interactiveEditor.arrowOutUp', id: 'interactiveEditor.arrowOutUp',
title: localize('arrowUp', 'Cursor Up'), title: localize('arrowUp', 'Cursor Up'),
precondition: ContextKeyExpr.and(CTX_INTERACTIVE_EDITOR_FOCUSED, CTX_INTERACTIVE_EDITOR_INNER_CURSOR_FIRST, EditorContextKeys.isEmbeddedDiffEditor.negate(), CONTEXT_ACCESSIBILITY_MODE_ENABLED.negate()), precondition: ContextKeyExpr.and(CTX_INLINE_CHAT_FOCUSED, CTX_INLINE_CHAT_INNER_CURSOR_FIRST, EditorContextKeys.isEmbeddedDiffEditor.negate(), CONTEXT_ACCESSIBILITY_MODE_ENABLED.negate()),
keybinding: { keybinding: {
weight: KeybindingWeight.EditorCore, weight: KeybindingWeight.EditorCore,
primary: KeyCode.UpArrow primary: KeyCode.UpArrow
@ -194,17 +194,17 @@ export class ArrowOutUpAction extends AbstractInteractiveEditorAction {
}); });
} }
runInteractiveEditorCommand(_accessor: ServicesAccessor, ctrl: InteractiveEditorController, _editor: ICodeEditor, ..._args: any[]): void { runInlineChatCommand(_accessor: ServicesAccessor, ctrl: InlineChatController, _editor: ICodeEditor, ..._args: any[]): void {
ctrl.arrowOut(true); ctrl.arrowOut(true);
} }
} }
export class ArrowOutDownAction extends AbstractInteractiveEditorAction { export class ArrowOutDownAction extends AbstractInlineChatAction {
constructor() { constructor() {
super({ super({
id: 'interactiveEditor.arrowOutDown', id: 'interactiveEditor.arrowOutDown',
title: localize('arrowDown', 'Cursor Down'), title: localize('arrowDown', 'Cursor Down'),
precondition: ContextKeyExpr.and(CTX_INTERACTIVE_EDITOR_FOCUSED, CTX_INTERACTIVE_EDITOR_INNER_CURSOR_LAST, EditorContextKeys.isEmbeddedDiffEditor.negate(), CONTEXT_ACCESSIBILITY_MODE_ENABLED.negate()), precondition: ContextKeyExpr.and(CTX_INLINE_CHAT_FOCUSED, CTX_INLINE_CHAT_INNER_CURSOR_LAST, EditorContextKeys.isEmbeddedDiffEditor.negate(), CONTEXT_ACCESSIBILITY_MODE_ENABLED.negate()),
keybinding: { keybinding: {
weight: KeybindingWeight.EditorCore, weight: KeybindingWeight.EditorCore,
primary: KeyCode.DownArrow primary: KeyCode.DownArrow
@ -212,44 +212,44 @@ export class ArrowOutDownAction extends AbstractInteractiveEditorAction {
}); });
} }
runInteractiveEditorCommand(_accessor: ServicesAccessor, ctrl: InteractiveEditorController, _editor: ICodeEditor, ..._args: any[]): void { runInlineChatCommand(_accessor: ServicesAccessor, ctrl: InlineChatController, _editor: ICodeEditor, ..._args: any[]): void {
ctrl.arrowOut(false); ctrl.arrowOut(false);
} }
} }
export class FocusInteractiveEditor extends EditorAction2 { export class FocusInlineChat extends EditorAction2 {
constructor() { constructor() {
super({ super({
id: 'interactiveEditor.focus', id: 'interactiveEditor.focus',
title: { value: localize('focus', 'Focus Input'), original: 'Focus Input' }, title: { value: localize('focus', 'Focus Input'), original: 'Focus Input' },
f1: true, f1: true,
category: AbstractInteractiveEditorAction.category, category: AbstractInlineChatAction.category,
precondition: ContextKeyExpr.and(EditorContextKeys.editorTextFocus, CTX_INTERACTIVE_EDITOR_VISIBLE, CTX_INTERACTIVE_EDITOR_FOCUSED.negate(), CONTEXT_ACCESSIBILITY_MODE_ENABLED.negate()), precondition: ContextKeyExpr.and(EditorContextKeys.editorTextFocus, CTX_INLINE_CHAT_VISIBLE, CTX_INLINE_CHAT_FOCUSED.negate(), CONTEXT_ACCESSIBILITY_MODE_ENABLED.negate()),
keybinding: [{ keybinding: [{
weight: KeybindingWeight.EditorCore + 10, // win against core_command weight: KeybindingWeight.EditorCore + 10, // win against core_command
when: ContextKeyExpr.and(CTX_INTERACTIVE_EDITOR_OUTER_CURSOR_POSITION.isEqualTo('above'), EditorContextKeys.isEmbeddedDiffEditor.negate()), when: ContextKeyExpr.and(CTX_INLINE_CHAT_OUTER_CURSOR_POSITION.isEqualTo('above'), EditorContextKeys.isEmbeddedDiffEditor.negate()),
primary: KeyCode.DownArrow, primary: KeyCode.DownArrow,
}, { }, {
weight: KeybindingWeight.EditorCore + 10, // win against core_command weight: KeybindingWeight.EditorCore + 10, // win against core_command
when: ContextKeyExpr.and(CTX_INTERACTIVE_EDITOR_OUTER_CURSOR_POSITION.isEqualTo('below'), EditorContextKeys.isEmbeddedDiffEditor.negate()), when: ContextKeyExpr.and(CTX_INLINE_CHAT_OUTER_CURSOR_POSITION.isEqualTo('below'), EditorContextKeys.isEmbeddedDiffEditor.negate()),
primary: KeyCode.UpArrow, primary: KeyCode.UpArrow,
}] }]
}); });
} }
override runEditorCommand(_accessor: ServicesAccessor, editor: ICodeEditor, ..._args: any[]) { override runEditorCommand(_accessor: ServicesAccessor, editor: ICodeEditor, ..._args: any[]) {
InteractiveEditorController.get(editor)?.focus(); InlineChatController.get(editor)?.focus();
} }
} }
export class PreviousFromHistory extends AbstractInteractiveEditorAction { export class PreviousFromHistory extends AbstractInlineChatAction {
constructor() { constructor() {
super({ super({
id: 'interactiveEditor.previousFromHistory', id: 'interactiveEditor.previousFromHistory',
title: localize('previousFromHistory', 'Previous From History'), title: localize('previousFromHistory', 'Previous From History'),
precondition: CTX_INTERACTIVE_EDITOR_FOCUSED, precondition: CTX_INLINE_CHAT_FOCUSED,
keybinding: { keybinding: {
weight: KeybindingWeight.EditorCore + 10, // win against core_command weight: KeybindingWeight.EditorCore + 10, // win against core_command
primary: KeyMod.CtrlCmd | KeyCode.UpArrow, primary: KeyMod.CtrlCmd | KeyCode.UpArrow,
@ -257,18 +257,18 @@ export class PreviousFromHistory extends AbstractInteractiveEditorAction {
}); });
} }
override runInteractiveEditorCommand(_accessor: ServicesAccessor, ctrl: InteractiveEditorController, _editor: ICodeEditor, ..._args: any[]): void { override runInlineChatCommand(_accessor: ServicesAccessor, ctrl: InlineChatController, _editor: ICodeEditor, ..._args: any[]): void {
ctrl.populateHistory(true); ctrl.populateHistory(true);
} }
} }
export class NextFromHistory extends AbstractInteractiveEditorAction { export class NextFromHistory extends AbstractInlineChatAction {
constructor() { constructor() {
super({ super({
id: 'interactiveEditor.nextFromHistory', id: 'interactiveEditor.nextFromHistory',
title: localize('nextFromHistory', 'Next From History'), title: localize('nextFromHistory', 'Next From History'),
precondition: CTX_INTERACTIVE_EDITOR_FOCUSED, precondition: CTX_INLINE_CHAT_FOCUSED,
keybinding: { keybinding: {
weight: KeybindingWeight.EditorCore + 10, // win against core_command weight: KeybindingWeight.EditorCore + 10, // win against core_command
primary: KeyMod.CtrlCmd | KeyCode.DownArrow, primary: KeyMod.CtrlCmd | KeyCode.DownArrow,
@ -276,68 +276,68 @@ export class NextFromHistory extends AbstractInteractiveEditorAction {
}); });
} }
override runInteractiveEditorCommand(_accessor: ServicesAccessor, ctrl: InteractiveEditorController, _editor: ICodeEditor, ..._args: any[]): void { override runInlineChatCommand(_accessor: ServicesAccessor, ctrl: InlineChatController, _editor: ICodeEditor, ..._args: any[]): void {
ctrl.populateHistory(false); ctrl.populateHistory(false);
} }
} }
MenuRegistry.appendMenuItem(MENU_INTERACTIVE_EDITOR_WIDGET_STATUS, { MenuRegistry.appendMenuItem(MENU_INLINE_CHAT_WIDGET_STATUS, {
submenu: MENU_INTERACTIVE_EDITOR_WIDGET_DISCARD, submenu: MENU_INLINE_CHAT_WIDGET_DISCARD,
title: localize('discardMenu', "Discard..."), title: localize('discardMenu', "Discard..."),
icon: Codicon.discard, icon: Codicon.discard,
group: '0_main', group: '0_main',
order: 2, order: 2,
when: CTX_INTERACTIVE_EDITOR_EDIT_MODE.notEqualsTo(EditMode.Preview), when: CTX_INLINE_CHAT_EDIT_MODE.notEqualsTo(EditMode.Preview),
rememberDefaultAction: true rememberDefaultAction: true
}); });
export class DiscardAction extends AbstractInteractiveEditorAction { export class DiscardAction extends AbstractInlineChatAction {
constructor() { constructor() {
super({ super({
id: 'interactiveEditor.discard', id: 'interactiveEditor.discard',
title: localize('discard', 'Discard'), title: localize('discard', 'Discard'),
icon: Codicon.discard, icon: Codicon.discard,
precondition: CTX_INTERACTIVE_EDITOR_VISIBLE, precondition: CTX_INLINE_CHAT_VISIBLE,
keybinding: { keybinding: {
weight: KeybindingWeight.EditorContrib, weight: KeybindingWeight.EditorContrib,
primary: KeyCode.Escape primary: KeyCode.Escape
}, },
menu: { menu: {
id: MENU_INTERACTIVE_EDITOR_WIDGET_DISCARD, id: MENU_INLINE_CHAT_WIDGET_DISCARD,
group: '0_main', group: '0_main',
order: 0 order: 0
} }
}); });
} }
async runInteractiveEditorCommand(_accessor: ServicesAccessor, ctrl: InteractiveEditorController, _editor: ICodeEditor, ..._args: any[]): Promise<void> { async runInlineChatCommand(_accessor: ServicesAccessor, ctrl: InlineChatController, _editor: ICodeEditor, ..._args: any[]): Promise<void> {
ctrl.cancelSession(); ctrl.cancelSession();
} }
} }
export class DiscardToClipboardAction extends AbstractInteractiveEditorAction { export class DiscardToClipboardAction extends AbstractInlineChatAction {
constructor() { constructor() {
super({ super({
id: 'interactiveEditor.discardToClipboard', id: 'interactiveEditor.discardToClipboard',
title: localize('undo.clipboard', 'Discard to Clipboard'), title: localize('undo.clipboard', 'Discard to Clipboard'),
precondition: ContextKeyExpr.and(CTX_INTERACTIVE_EDITOR_VISIBLE, CTX_INTERACTIVE_EDITOR_DID_EDIT), precondition: ContextKeyExpr.and(CTX_INLINE_CHAT_VISIBLE, CTX_INLINE_CHAT_DID_EDIT),
// keybinding: { // keybinding: {
// weight: KeybindingWeight.EditorContrib + 10, // weight: KeybindingWeight.EditorContrib + 10,
// primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KeyZ, // primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KeyZ,
// mac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KeyZ }, // mac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KeyZ },
// }, // },
menu: { menu: {
id: MENU_INTERACTIVE_EDITOR_WIDGET_DISCARD, id: MENU_INLINE_CHAT_WIDGET_DISCARD,
group: '0_main', group: '0_main',
order: 1 order: 1
} }
}); });
} }
override async runInteractiveEditorCommand(accessor: ServicesAccessor, ctrl: InteractiveEditorController): Promise<void> { override async runInlineChatCommand(accessor: ServicesAccessor, ctrl: InlineChatController): Promise<void> {
const clipboardService = accessor.get(IClipboardService); const clipboardService = accessor.get(IClipboardService);
const changedText = ctrl.cancelSession(); const changedText = ctrl.cancelSession();
if (changedText !== undefined) { if (changedText !== undefined) {
@ -346,22 +346,22 @@ export class DiscardToClipboardAction extends AbstractInteractiveEditorAction {
} }
} }
export class DiscardUndoToNewFileAction extends AbstractInteractiveEditorAction { export class DiscardUndoToNewFileAction extends AbstractInlineChatAction {
constructor() { constructor() {
super({ super({
id: 'interactiveEditor.discardToFile', id: 'interactiveEditor.discardToFile',
title: localize('undo.newfile', 'Discard to New File'), title: localize('undo.newfile', 'Discard to New File'),
precondition: ContextKeyExpr.and(CTX_INTERACTIVE_EDITOR_VISIBLE, CTX_INTERACTIVE_EDITOR_DID_EDIT), precondition: ContextKeyExpr.and(CTX_INLINE_CHAT_VISIBLE, CTX_INLINE_CHAT_DID_EDIT),
menu: { menu: {
id: MENU_INTERACTIVE_EDITOR_WIDGET_DISCARD, id: MENU_INLINE_CHAT_WIDGET_DISCARD,
group: '0_main', group: '0_main',
order: 2 order: 2
} }
}); });
} }
override async runInteractiveEditorCommand(accessor: ServicesAccessor, ctrl: InteractiveEditorController, editor: ICodeEditor, ..._args: any[]): Promise<void> { override async runInlineChatCommand(accessor: ServicesAccessor, ctrl: InlineChatController, editor: ICodeEditor, ..._args: any[]): Promise<void> {
const editorService = accessor.get(IEditorService); const editorService = accessor.get(IEditorService);
const changedText = ctrl.cancelSession(); const changedText = ctrl.cancelSession();
if (changedText !== undefined) { if (changedText !== undefined) {
@ -371,74 +371,74 @@ export class DiscardUndoToNewFileAction extends AbstractInteractiveEditorAction
} }
} }
export class FeebackHelpfulCommand extends AbstractInteractiveEditorAction { export class FeebackHelpfulCommand extends AbstractInlineChatAction {
constructor() { constructor() {
super({ super({
id: 'interactiveEditor.feedbackHelpful', id: 'interactiveEditor.feedbackHelpful',
title: localize('feedback.helpful', 'Helpful'), title: localize('feedback.helpful', 'Helpful'),
icon: Codicon.thumbsup, icon: Codicon.thumbsup,
precondition: CTX_INTERACTIVE_EDITOR_VISIBLE, precondition: CTX_INLINE_CHAT_VISIBLE,
toggled: CTX_INTERACTIVE_EDITOR_LAST_FEEDBACK.isEqualTo('helpful'), toggled: CTX_INLINE_CHAT_LAST_FEEDBACK.isEqualTo('helpful'),
menu: { menu: {
id: MENU_INTERACTIVE_EDITOR_WIDGET_FEEDBACK, id: MENU_INLINE_CHAT_WIDGET_FEEDBACK,
when: CTX_INTERACTIVE_EDITOR_LAST_RESPONSE_TYPE.notEqualsTo(undefined), when: CTX_INLINE_CHAT_LAST_RESPONSE_TYPE.notEqualsTo(undefined),
group: '2_feedback', group: '2_feedback',
order: 1 order: 1
} }
}); });
} }
override runInteractiveEditorCommand(_accessor: ServicesAccessor, ctrl: InteractiveEditorController): void { override runInlineChatCommand(_accessor: ServicesAccessor, ctrl: InlineChatController): void {
ctrl.feedbackLast(true); ctrl.feedbackLast(true);
} }
} }
export class FeebackUnhelpfulCommand extends AbstractInteractiveEditorAction { export class FeebackUnhelpfulCommand extends AbstractInlineChatAction {
constructor() { constructor() {
super({ super({
id: 'interactiveEditor.feedbackunhelpful', id: 'interactiveEditor.feedbackunhelpful',
title: localize('feedback.unhelpful', 'Unhelpful'), title: localize('feedback.unhelpful', 'Unhelpful'),
icon: Codicon.thumbsdown, icon: Codicon.thumbsdown,
precondition: CTX_INTERACTIVE_EDITOR_VISIBLE, precondition: CTX_INLINE_CHAT_VISIBLE,
toggled: CTX_INTERACTIVE_EDITOR_LAST_FEEDBACK.isEqualTo('unhelpful'), toggled: CTX_INLINE_CHAT_LAST_FEEDBACK.isEqualTo('unhelpful'),
menu: { menu: {
id: MENU_INTERACTIVE_EDITOR_WIDGET_FEEDBACK, id: MENU_INLINE_CHAT_WIDGET_FEEDBACK,
when: CTX_INTERACTIVE_EDITOR_LAST_RESPONSE_TYPE.notEqualsTo(undefined), when: CTX_INLINE_CHAT_LAST_RESPONSE_TYPE.notEqualsTo(undefined),
group: '2_feedback', group: '2_feedback',
order: 2 order: 2
} }
}); });
} }
override runInteractiveEditorCommand(_accessor: ServicesAccessor, ctrl: InteractiveEditorController): void { override runInlineChatCommand(_accessor: ServicesAccessor, ctrl: InlineChatController): void {
ctrl.feedbackLast(false); ctrl.feedbackLast(false);
} }
} }
export class ToggleInlineDiff extends AbstractInteractiveEditorAction { export class ToggleInlineDiff extends AbstractInlineChatAction {
constructor() { constructor() {
super({ super({
id: 'interactiveEditor.toggleDiff', id: 'interactiveEditor.toggleDiff',
title: localize('toggleDiff', 'Toggle Diff'), title: localize('toggleDiff', 'Toggle Diff'),
icon: Codicon.diff, icon: Codicon.diff,
precondition: ContextKeyExpr.and(CTX_INTERACTIVE_EDITOR_VISIBLE, CTX_INTERACTIVE_EDITOR_DID_EDIT), precondition: ContextKeyExpr.and(CTX_INLINE_CHAT_VISIBLE, CTX_INLINE_CHAT_DID_EDIT),
toggled: { condition: CTX_INTERACTIVE_EDITOR_SHOWING_DIFF, title: localize('toggleDiff2', "Show Inline Diff") }, toggled: { condition: CTX_INLINE_CHAT_SHOWING_DIFF, title: localize('toggleDiff2', "Show Inline Diff") },
menu: { menu: {
id: MENU_INTERACTIVE_EDITOR_WIDGET_DISCARD, id: MENU_INLINE_CHAT_WIDGET_DISCARD,
when: CTX_INTERACTIVE_EDITOR_EDIT_MODE.notEqualsTo(EditMode.Preview), when: CTX_INLINE_CHAT_EDIT_MODE.notEqualsTo(EditMode.Preview),
group: '1_config', group: '1_config',
order: 9 order: 9
} }
}); });
} }
override runInteractiveEditorCommand(_accessor: ServicesAccessor, ctrl: InteractiveEditorController): void { override runInlineChatCommand(_accessor: ServicesAccessor, ctrl: InlineChatController): void {
ctrl.toggleDiff(); ctrl.toggleDiff();
} }
} }
export class ApplyPreviewEdits extends AbstractInteractiveEditorAction { export class ApplyPreviewEdits extends AbstractInlineChatAction {
constructor() { constructor() {
super({ super({
@ -446,51 +446,51 @@ export class ApplyPreviewEdits extends AbstractInteractiveEditorAction {
title: localize('apply1', 'Accept Changes'), title: localize('apply1', 'Accept Changes'),
shortTitle: localize('apply2', 'Accept'), shortTitle: localize('apply2', 'Accept'),
icon: Codicon.check, icon: Codicon.check,
precondition: ContextKeyExpr.and(CTX_INTERACTIVE_EDITOR_VISIBLE, ContextKeyExpr.or(CTX_INTERACTIVE_EDITOR_DOCUMENT_CHANGED.toNegated(), CTX_INTERACTIVE_EDITOR_EDIT_MODE.notEqualsTo(EditMode.Preview))), precondition: ContextKeyExpr.and(CTX_INLINE_CHAT_VISIBLE, ContextKeyExpr.or(CTX_INLINE_CHAT_DOCUMENT_CHANGED.toNegated(), CTX_INLINE_CHAT_EDIT_MODE.notEqualsTo(EditMode.Preview))),
keybinding: [{ keybinding: [{
weight: KeybindingWeight.EditorContrib + 10, weight: KeybindingWeight.EditorContrib + 10,
primary: KeyMod.CtrlCmd | KeyCode.Enter, primary: KeyMod.CtrlCmd | KeyCode.Enter,
}], }],
menu: { menu: {
id: MENU_INTERACTIVE_EDITOR_WIDGET_STATUS, id: MENU_INLINE_CHAT_WIDGET_STATUS,
group: '0_main', group: '0_main',
order: 0 order: 0
} }
}); });
} }
override async runInteractiveEditorCommand(_accessor: ServicesAccessor, ctrl: InteractiveEditorController): Promise<void> { override async runInlineChatCommand(_accessor: ServicesAccessor, ctrl: InlineChatController): Promise<void> {
ctrl.acceptSession(); ctrl.acceptSession();
} }
} }
export class CancelSessionAction extends AbstractInteractiveEditorAction { export class CancelSessionAction extends AbstractInlineChatAction {
constructor() { constructor() {
super({ super({
id: 'interactiveEditor.cancel', id: 'interactiveEditor.cancel',
title: localize('cancel', 'Cancel'), title: localize('cancel', 'Cancel'),
icon: Codicon.clearAll, icon: Codicon.clearAll,
precondition: ContextKeyExpr.and(CTX_INTERACTIVE_EDITOR_VISIBLE, CTX_INTERACTIVE_EDITOR_EDIT_MODE.isEqualTo(EditMode.Preview)), precondition: ContextKeyExpr.and(CTX_INLINE_CHAT_VISIBLE, CTX_INLINE_CHAT_EDIT_MODE.isEqualTo(EditMode.Preview)),
keybinding: { keybinding: {
weight: KeybindingWeight.EditorContrib - 1, weight: KeybindingWeight.EditorContrib - 1,
primary: KeyCode.Escape primary: KeyCode.Escape
}, },
menu: { menu: {
id: MENU_INTERACTIVE_EDITOR_WIDGET_STATUS, id: MENU_INLINE_CHAT_WIDGET_STATUS,
when: CTX_INTERACTIVE_EDITOR_EDIT_MODE.isEqualTo(EditMode.Preview), when: CTX_INLINE_CHAT_EDIT_MODE.isEqualTo(EditMode.Preview),
group: '0_main', group: '0_main',
order: 1 order: 1
} }
}); });
} }
async runInteractiveEditorCommand(_accessor: ServicesAccessor, ctrl: InteractiveEditorController, _editor: ICodeEditor, ..._args: any[]): Promise<void> { async runInlineChatCommand(_accessor: ServicesAccessor, ctrl: InlineChatController, _editor: ICodeEditor, ..._args: any[]): Promise<void> {
ctrl.cancelSession(); ctrl.cancelSession();
} }
} }
export class CopyRecordings extends AbstractInteractiveEditorAction { export class CopyRecordings extends AbstractInlineChatAction {
constructor() { constructor() {
super({ super({
@ -503,11 +503,11 @@ export class CopyRecordings extends AbstractInteractiveEditorAction {
}); });
} }
override async runInteractiveEditorCommand(accessor: ServicesAccessor): Promise<void> { override async runInlineChatCommand(accessor: ServicesAccessor): Promise<void> {
const clipboardService = accessor.get(IClipboardService); const clipboardService = accessor.get(IClipboardService);
const quickPickService = accessor.get(IQuickInputService); const quickPickService = accessor.get(IQuickInputService);
const ieSessionService = accessor.get(IInteractiveEditorSessionService); const ieSessionService = accessor.get(IInlineChatSessionService);
const recordings = ieSessionService.recordings().filter(r => r.exchanges.length > 0); const recordings = ieSessionService.recordings().filter(r => r.exchanges.length > 0);
if (recordings.length === 0) { if (recordings.length === 0) {
@ -529,62 +529,62 @@ export class CopyRecordings extends AbstractInteractiveEditorAction {
} }
} }
export class ViewInChatAction extends AbstractInteractiveEditorAction { export class ViewInChatAction extends AbstractInlineChatAction {
constructor() { constructor() {
super({ super({
id: 'interactiveEditor.viewInChat', id: 'interactiveEditor.viewInChat',
title: localize('viewInChat', 'View in Chat'), title: localize('viewInChat', 'View in Chat'),
icon: Codicon.commentDiscussion, icon: Codicon.commentDiscussion,
precondition: CTX_INTERACTIVE_EDITOR_VISIBLE, precondition: CTX_INLINE_CHAT_VISIBLE,
menu: { menu: {
id: MENU_INTERACTIVE_EDITOR_WIDGET_MARKDOWN_MESSAGE, id: MENU_INLINE_CHAT_WIDGET_MARKDOWN_MESSAGE,
when: CTX_INTERACTIVE_EDITOR_LAST_RESPONSE_TYPE.isEqualTo('message'), when: CTX_INLINE_CHAT_LAST_RESPONSE_TYPE.isEqualTo('message'),
group: '1_viewInChat', group: '1_viewInChat',
order: 1 order: 1
} }
}); });
} }
override runInteractiveEditorCommand(_accessor: ServicesAccessor, ctrl: InteractiveEditorController, _editor: ICodeEditor, ..._args: any[]): void { override runInlineChatCommand(_accessor: ServicesAccessor, ctrl: InlineChatController, _editor: ICodeEditor, ..._args: any[]): void {
ctrl.viewInChat(); ctrl.viewInChat();
} }
} }
export class ExpandMessageAction extends AbstractInteractiveEditorAction { export class ExpandMessageAction extends AbstractInlineChatAction {
constructor() { constructor() {
super({ super({
id: 'interactiveEditor.expandMessageAction', id: 'interactiveEditor.expandMessageAction',
title: localize('expandMessage', 'Expand Message'), title: localize('expandMessage', 'Expand Message'),
icon: Codicon.chevronDown, icon: Codicon.chevronDown,
precondition: CTX_INTERACTIVE_EDITOR_VISIBLE, precondition: CTX_INLINE_CHAT_VISIBLE,
menu: { menu: {
id: MENU_INTERACTIVE_EDITOR_WIDGET_MARKDOWN_MESSAGE, id: MENU_INLINE_CHAT_WIDGET_MARKDOWN_MESSAGE,
when: ContextKeyExpr.and(CTX_INTERACTIVE_EDITOR_LAST_RESPONSE_TYPE.isEqualTo('message'), CTX_INTERACTIVE_EDITOR_MESSAGE_CROP_STATE.isEqualTo('cropped')), when: ContextKeyExpr.and(CTX_INLINE_CHAT_LAST_RESPONSE_TYPE.isEqualTo('message'), CTX_INLINE_CHAT_MESSAGE_CROP_STATE.isEqualTo('cropped')),
group: '2_expandOrContract', group: '2_expandOrContract',
order: 1 order: 1
} }
}); });
} }
override runInteractiveEditorCommand(_accessor: ServicesAccessor, ctrl: InteractiveEditorController, _editor: ICodeEditor, ..._args: any[]): void { override runInlineChatCommand(_accessor: ServicesAccessor, ctrl: InlineChatController, _editor: ICodeEditor, ..._args: any[]): void {
ctrl.updateExpansionState(true); ctrl.updateExpansionState(true);
} }
} }
export class ContractMessageAction extends AbstractInteractiveEditorAction { export class ContractMessageAction extends AbstractInlineChatAction {
constructor() { constructor() {
super({ super({
id: 'interactiveEditor.contractMessageAction', id: 'interactiveEditor.contractMessageAction',
title: localize('contractMessage', 'Contract Message'), title: localize('contractMessage', 'Contract Message'),
icon: Codicon.chevronUp, icon: Codicon.chevronUp,
precondition: CTX_INTERACTIVE_EDITOR_VISIBLE, precondition: CTX_INLINE_CHAT_VISIBLE,
menu: { menu: {
id: MENU_INTERACTIVE_EDITOR_WIDGET_MARKDOWN_MESSAGE, id: MENU_INLINE_CHAT_WIDGET_MARKDOWN_MESSAGE,
when: ContextKeyExpr.and(CTX_INTERACTIVE_EDITOR_LAST_RESPONSE_TYPE.isEqualTo('message'), CTX_INTERACTIVE_EDITOR_MESSAGE_CROP_STATE.isEqualTo('expanded')), when: ContextKeyExpr.and(CTX_INLINE_CHAT_LAST_RESPONSE_TYPE.isEqualTo('message'), CTX_INLINE_CHAT_MESSAGE_CROP_STATE.isEqualTo('expanded')),
group: '2_expandOrContract', group: '2_expandOrContract',
order: 1 order: 1
} }
}); });
} }
override runInteractiveEditorCommand(_accessor: ServicesAccessor, ctrl: InteractiveEditorController, _editor: ICodeEditor, ..._args: any[]): void { override runInlineChatCommand(_accessor: ServicesAccessor, ctrl: InlineChatController, _editor: ICodeEditor, ..._args: any[]): void {
ctrl.updateExpansionState(false); ctrl.updateExpansionState(false);
} }
} }
@ -594,9 +594,9 @@ export class AccessibilityHelpEditorAction extends EditorAction2 {
super({ super({
id: 'interactiveEditor.accessibilityHelp', id: 'interactiveEditor.accessibilityHelp',
title: localize('actions.interactiveSession.accessibiltyHelpEditor', "Interactive Session Editor Accessibility Help"), title: localize('actions.interactiveSession.accessibiltyHelpEditor', "Interactive Session Editor Accessibility Help"),
category: AbstractInteractiveEditorAction.category, category: AbstractInlineChatAction.category,
keybinding: { keybinding: {
when: CTX_INTERACTIVE_EDITOR_FOCUSED, when: CTX_INLINE_CHAT_FOCUSED,
primary: KeyMod.Alt | KeyCode.F1, primary: KeyMod.Alt | KeyCode.F1,
weight: KeybindingWeight.EditorContrib weight: KeybindingWeight.EditorContrib
} }

View file

@ -28,10 +28,10 @@ import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/c
import { IDialogService } from 'vs/platform/dialogs/common/dialogs'; import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { ILogService } from 'vs/platform/log/common/log'; import { ILogService } from 'vs/platform/log/common/log';
import { EditResponse, EmptyResponse, ErrorResponse, ExpansionState, IInteractiveEditorSessionService, MarkdownResponse, Session, SessionExchange } from 'vs/workbench/contrib/inlineChat/browser/inlineChatSession'; import { EditResponse, EmptyResponse, ErrorResponse, ExpansionState, IInlineChatSessionService, MarkdownResponse, Session, SessionExchange } from 'vs/workbench/contrib/inlineChat/browser/inlineChatSession';
import { EditModeStrategy, LivePreviewStrategy, LiveStrategy, PreviewStrategy } from 'vs/workbench/contrib/inlineChat/browser/inlineChatStrategies'; import { EditModeStrategy, LivePreviewStrategy, LiveStrategy, PreviewStrategy } from 'vs/workbench/contrib/inlineChat/browser/inlineChatStrategies';
import { InteractiveEditorZoneWidget } from 'vs/workbench/contrib/inlineChat/browser/inlineChatWidget'; import { InlineChatZoneWidget } from 'vs/workbench/contrib/inlineChat/browser/inlineChatWidget';
import { CTX_INTERACTIVE_EDITOR_HAS_ACTIVE_REQUEST, CTX_INTERACTIVE_EDITOR_LAST_FEEDBACK, IInteractiveEditorRequest, IInteractiveEditorResponse, INTERACTIVE_EDITOR_ID, EditMode, InteractiveEditorResponseFeedbackKind, CTX_INTERACTIVE_EDITOR_LAST_RESPONSE_TYPE, InteractiveEditorResponseType, CTX_INTERACTIVE_EDITOR_DID_EDIT, CTX_INTERACTIVE_EDITOR_HAS_STASHED_SESSION } from 'vs/workbench/contrib/inlineChat/common/inlineChat'; import { CTX_INLINE_CHAT_HAS_ACTIVE_REQUEST, CTX_INLINE_CHAT_LAST_FEEDBACK, IInlineChatRequest, IInlineChatResponse, INLINE_CHAT_ID, EditMode, InlineChatResponseFeedbackKind, CTX_INLINE_CHAT_LAST_RESPONSE_TYPE, InlineChatResponseType, CTX_INLINE_CHAT_DID_EDIT, CTX_INLINE_CHAT_HAS_STASHED_SESSION } from 'vs/workbench/contrib/inlineChat/common/inlineChat';
import { IChatWidgetService } from 'vs/workbench/contrib/chat/browser/chat'; import { IChatWidgetService } from 'vs/workbench/contrib/chat/browser/chat';
import { IChatService } from 'vs/workbench/contrib/chat/common/chatService'; import { IChatService } from 'vs/workbench/contrib/chat/common/chatService';
import { INotebookEditorService } from 'vs/workbench/contrib/notebook/browser/services/notebookEditorService'; import { INotebookEditorService } from 'vs/workbench/contrib/notebook/browser/services/notebookEditorService';
@ -61,7 +61,7 @@ const enum Message {
ACCEPT_INPUT = 1 << 5 ACCEPT_INPUT = 1 << 5
} }
export interface InteractiveEditorRunOptions { export interface InlineChatRunOptions {
initialRange?: IRange; initialRange?: IRange;
message?: string; message?: string;
autoSend?: boolean; autoSend?: boolean;
@ -69,10 +69,10 @@ export interface InteractiveEditorRunOptions {
isUnstashed?: boolean; isUnstashed?: boolean;
} }
export class InteractiveEditorController implements IEditorContribution { export class InlineChatController implements IEditorContribution {
static get(editor: ICodeEditor) { static get(editor: ICodeEditor) {
return editor.getContribution<InteractiveEditorController>(INTERACTIVE_EDITOR_ID); return editor.getContribution<InlineChatController>(INLINE_CHAT_ID);
} }
private static _decoBlock = ModelDecorationOptions.register({ private static _decoBlock = ModelDecorationOptions.register({
@ -86,9 +86,9 @@ export class InteractiveEditorController implements IEditorContribution {
private _historyOffset: number = -1; private _historyOffset: number = -1;
private readonly _store = new DisposableStore(); private readonly _store = new DisposableStore();
private readonly _zone: Lazy<InteractiveEditorZoneWidget>; private readonly _zone: Lazy<InlineChatZoneWidget>;
private readonly _ctxHasActiveRequest: IContextKey<boolean>; private readonly _ctxHasActiveRequest: IContextKey<boolean>;
private readonly _ctxLastResponseType: IContextKey<undefined | InteractiveEditorResponseType>; private readonly _ctxLastResponseType: IContextKey<undefined | InlineChatResponseType>;
private readonly _ctxDidEdit: IContextKey<boolean>; private readonly _ctxDidEdit: IContextKey<boolean>;
private readonly _ctxLastFeedbackKind: IContextKey<'helpful' | 'unhelpful' | ''>; private readonly _ctxLastFeedbackKind: IContextKey<'helpful' | 'unhelpful' | ''>;
@ -103,7 +103,7 @@ export class InteractiveEditorController implements IEditorContribution {
constructor( constructor(
private readonly _editor: ICodeEditor, private readonly _editor: ICodeEditor,
@IInstantiationService private readonly _instaService: IInstantiationService, @IInstantiationService private readonly _instaService: IInstantiationService,
@IInteractiveEditorSessionService private readonly _interactiveEditorSessionService: IInteractiveEditorSessionService, @IInlineChatSessionService private readonly _inlineChatSessionService: IInlineChatSessionService,
@IEditorWorkerService private readonly _editorWorkerService: IEditorWorkerService, @IEditorWorkerService private readonly _editorWorkerService: IEditorWorkerService,
@ILogService private readonly _logService: ILogService, @ILogService private readonly _logService: ILogService,
@IConfigurationService private readonly _configurationService: IConfigurationService, @IConfigurationService private readonly _configurationService: IConfigurationService,
@ -114,18 +114,18 @@ export class InteractiveEditorController implements IEditorContribution {
@IAccessibilityService private readonly _accessibilityService: IAccessibilityService, @IAccessibilityService private readonly _accessibilityService: IAccessibilityService,
@IKeybindingService private readonly _keybindingService: IKeybindingService, @IKeybindingService private readonly _keybindingService: IKeybindingService,
) { ) {
this._ctxHasActiveRequest = CTX_INTERACTIVE_EDITOR_HAS_ACTIVE_REQUEST.bindTo(contextKeyService); this._ctxHasActiveRequest = CTX_INLINE_CHAT_HAS_ACTIVE_REQUEST.bindTo(contextKeyService);
this._ctxDidEdit = CTX_INTERACTIVE_EDITOR_DID_EDIT.bindTo(contextKeyService); this._ctxDidEdit = CTX_INLINE_CHAT_DID_EDIT.bindTo(contextKeyService);
this._ctxLastResponseType = CTX_INTERACTIVE_EDITOR_LAST_RESPONSE_TYPE.bindTo(contextKeyService); this._ctxLastResponseType = CTX_INLINE_CHAT_LAST_RESPONSE_TYPE.bindTo(contextKeyService);
this._ctxLastFeedbackKind = CTX_INTERACTIVE_EDITOR_LAST_FEEDBACK.bindTo(contextKeyService); this._ctxLastFeedbackKind = CTX_INLINE_CHAT_LAST_FEEDBACK.bindTo(contextKeyService);
this._zone = new Lazy(() => this._store.add(_instaService.createInstance(InteractiveEditorZoneWidget, this._editor))); this._zone = new Lazy(() => this._store.add(_instaService.createInstance(InlineChatZoneWidget, this._editor)));
this._store.add(this._editor.onDidChangeModel(async e => { this._store.add(this._editor.onDidChangeModel(async e => {
if (this._activeSession || !e.newModelUrl) { if (this._activeSession || !e.newModelUrl) {
return; return;
} }
const existingSession = this._interactiveEditorSessionService.getSession(this._editor, e.newModelUrl); const existingSession = this._inlineChatSessionService.getSession(this._editor, e.newModelUrl);
if (!existingSession) { if (!existingSession) {
return; return;
} }
@ -153,7 +153,7 @@ export class InteractiveEditorController implements IEditorContribution {
} }
getId(): string { getId(): string {
return INTERACTIVE_EDITOR_ID; return INLINE_CHAT_ID;
} }
private _getMode(): EditMode { private _getMode(): EditMode {
@ -170,7 +170,7 @@ export class InteractiveEditorController implements IEditorContribution {
return this._zone.value.position; return this._zone.value.position;
} }
async run(options: InteractiveEditorRunOptions | undefined): Promise<void> { async run(options: InlineChatRunOptions | undefined): Promise<void> {
this._log('session starting'); this._log('session starting');
await this._finishExistingSession(); await this._finishExistingSession();
this._stashedSession.clear(); this._stashedSession.clear();
@ -193,7 +193,7 @@ export class InteractiveEditorController implements IEditorContribution {
// ---- state machine // ---- state machine
protected async _nextState(state: State, options: InteractiveEditorRunOptions | undefined): Promise<void> { protected async _nextState(state: State, options: InlineChatRunOptions | undefined): Promise<void> {
this._log('setState to ', state); this._log('setState to ', state);
const nextState = await this[state](options); const nextState = await this[state](options);
if (nextState) { if (nextState) {
@ -201,7 +201,7 @@ export class InteractiveEditorController implements IEditorContribution {
} }
} }
private async [State.CREATE_SESSION](options: InteractiveEditorRunOptions | undefined): Promise<State.CANCEL | State.INIT_UI> { private async [State.CREATE_SESSION](options: InlineChatRunOptions | undefined): Promise<State.CANCEL | State.INIT_UI> {
assertType(this._activeSession === undefined); assertType(this._activeSession === undefined);
assertType(this._editor.hasModel()); assertType(this._editor.hasModel());
@ -214,7 +214,7 @@ export class InteractiveEditorController implements IEditorContribution {
createSessionCts.cancel(); createSessionCts.cancel();
}); });
session = await this._interactiveEditorSessionService.createSession( session = await this._inlineChatSessionService.createSession(
this._editor, this._editor,
{ editMode: this._getMode(), wholeRange: options?.initialRange }, { editMode: this._getMode(), wholeRange: options?.initialRange },
createSessionCts.token createSessionCts.token
@ -249,7 +249,7 @@ export class InteractiveEditorController implements IEditorContribution {
return State.INIT_UI; return State.INIT_UI;
} }
private async [State.INIT_UI](options: InteractiveEditorRunOptions | undefined): Promise<State.WAIT_FOR_INPUT | State.SHOW_RESPONSE | State.APPLY_RESPONSE> { private async [State.INIT_UI](options: InlineChatRunOptions | undefined): Promise<State.WAIT_FOR_INPUT | State.SHOW_RESPONSE | State.APPLY_RESPONSE> {
assertType(this._activeSession); assertType(this._activeSession);
// hide/cancel inline completions when invoking IE // hide/cancel inline completions when invoking IE
@ -261,7 +261,7 @@ export class InteractiveEditorController implements IEditorContribution {
const wholeRangeDecoration = this._editor.createDecorationsCollection([{ const wholeRangeDecoration = this._editor.createDecorationsCollection([{
range: this._activeSession.wholeRange.value, range: this._activeSession.wholeRange.value,
options: InteractiveEditorController._decoBlock options: InlineChatController._decoBlock
}]); }]);
this._sessionStore.add(toDisposable(() => wholeRangeDecoration.clear())); this._sessionStore.add(toDisposable(() => wholeRangeDecoration.clear()));
@ -314,7 +314,7 @@ export class InteractiveEditorController implements IEditorContribution {
return ''; return '';
} }
let result = this._activeSession.session.placeholder ?? localize('default.placeholder', "Ask a question"); let result = this._activeSession.session.placeholder ?? localize('default.placeholder', "Ask a question");
if (InteractiveEditorController._promptHistory.length > 0) { if (InlineChatController._promptHistory.length > 0) {
const kb1 = this._keybindingService.lookupKeybinding('interactiveEditor.previousFromHistory')?.getLabel(); const kb1 = this._keybindingService.lookupKeybinding('interactiveEditor.previousFromHistory')?.getLabel();
const kb2 = this._keybindingService.lookupKeybinding('interactiveEditor.nextFromHistory')?.getLabel(); const kb2 = this._keybindingService.lookupKeybinding('interactiveEditor.nextFromHistory')?.getLabel();
@ -346,7 +346,7 @@ export class InteractiveEditorController implements IEditorContribution {
// cancel all sibling sessions // cancel all sibling sessions
for (const editor of editors) { for (const editor of editors) {
if (editor !== this._editor) { if (editor !== this._editor) {
InteractiveEditorController.get(editor)?._finishExistingSession(); InlineChatController.get(editor)?._finishExistingSession();
} }
} }
break; break;
@ -355,7 +355,7 @@ export class InteractiveEditorController implements IEditorContribution {
} }
} }
private async [State.WAIT_FOR_INPUT](options: InteractiveEditorRunOptions | undefined): Promise<State.ACCEPT | State.CANCEL | State.PAUSE | State.WAIT_FOR_INPUT | State.MAKE_REQUEST> { private async [State.WAIT_FOR_INPUT](options: InlineChatRunOptions | undefined): Promise<State.ACCEPT | State.CANCEL | State.PAUSE | State.WAIT_FOR_INPUT | State.MAKE_REQUEST> {
assertType(this._activeSession); assertType(this._activeSession);
this._zone.value.widget.placeholder = this._getPlaceholderText(); this._zone.value.widget.placeholder = this._getPlaceholderText();
@ -403,8 +403,8 @@ export class InteractiveEditorController implements IEditorContribution {
const input = this._zone.value.widget.value; const input = this._zone.value.widget.value;
if (!InteractiveEditorController._promptHistory.includes(input)) { if (!InlineChatController._promptHistory.includes(input)) {
InteractiveEditorController._promptHistory.unshift(input); InlineChatController._promptHistory.unshift(input);
} }
const refer = this._activeSession.session.slashCommands?.some(value => value.refer && input!.startsWith(`/${value.command}`)); const refer = this._activeSession.session.slashCommands?.some(value => value.refer && input!.startsWith(`/${value.command}`));
@ -443,7 +443,7 @@ export class InteractiveEditorController implements IEditorContribution {
}); });
const sw = StopWatch.create(); const sw = StopWatch.create();
const request: IInteractiveEditorRequest = { const request: IInlineChatRequest = {
prompt: this._activeSession.lastInput, prompt: this._activeSession.lastInput,
selection: this._editor.getSelection(), selection: this._editor.getSelection(),
wholeRange: this._activeSession.wholeRange.value, wholeRange: this._activeSession.wholeRange.value,
@ -453,7 +453,7 @@ export class InteractiveEditorController implements IEditorContribution {
this._log('request started', this._activeSession.provider.debugName, this._activeSession.session, request); this._log('request started', this._activeSession.provider.debugName, this._activeSession.session, request);
let response: EditResponse | MarkdownResponse | ErrorResponse | EmptyResponse; let response: EditResponse | MarkdownResponse | ErrorResponse | EmptyResponse;
let reply: IInteractiveEditorResponse | null | undefined; let reply: IInlineChatResponse | null | undefined;
try { try {
this._zone.value.widget.updateProgress(true); this._zone.value.widget.updateProgress(true);
this._zone.value.widget.updateInfo(!this._activeSession.lastExchange ? localize('thinking', "Thinking\u2026") : ''); this._zone.value.widget.updateInfo(!this._activeSession.lastExchange ? localize('thinking', "Thinking\u2026") : '');
@ -610,7 +610,7 @@ export class InteractiveEditorController implements IEditorContribution {
this._log(err); this._log(err);
} }
this._interactiveEditorSessionService.releaseSession(this._activeSession); this._inlineChatSessionService.releaseSession(this._activeSession);
this[State.PAUSE](); this[State.PAUSE]();
} }
@ -636,7 +636,7 @@ export class InteractiveEditorController implements IEditorContribution {
// only stash sessions that had edits // only stash sessions that had edits
this._stashedSession.value = this._instaService.createInstance(StashedSession, this._editor, mySession); this._stashedSession.value = this._instaService.createInstance(StashedSession, this._editor, mySession);
} else { } else {
this._interactiveEditorSessionService.releaseSession(mySession); this._inlineChatSessionService.releaseSession(mySession);
} }
} }
@ -669,12 +669,12 @@ export class InteractiveEditorController implements IEditorContribution {
} }
populateHistory(up: boolean) { populateHistory(up: boolean) {
const len = InteractiveEditorController._promptHistory.length; const len = InlineChatController._promptHistory.length;
if (len === 0) { if (len === 0) {
return; return;
} }
const pos = (len + this._historyOffset + (up ? 1 : -1)) % len; const pos = (len + this._historyOffset + (up ? 1 : -1)) % len;
const entry = InteractiveEditorController._promptHistory[pos]; const entry = InlineChatController._promptHistory[pos];
this._zone.value.widget.value = entry; this._zone.value.widget.value = entry;
this._zone.value.widget.selectAll(); this._zone.value.widget.selectAll();
@ -697,8 +697,8 @@ export class InteractiveEditorController implements IEditorContribution {
feedbackLast(helpful: boolean) { feedbackLast(helpful: boolean) {
if (this._activeSession?.lastExchange?.response instanceof EditResponse || this._activeSession?.lastExchange?.response instanceof MarkdownResponse) { if (this._activeSession?.lastExchange?.response instanceof EditResponse || this._activeSession?.lastExchange?.response instanceof MarkdownResponse) {
const kind = helpful ? InteractiveEditorResponseFeedbackKind.Helpful : InteractiveEditorResponseFeedbackKind.Unhelpful; const kind = helpful ? InlineChatResponseFeedbackKind.Helpful : InlineChatResponseFeedbackKind.Unhelpful;
this._activeSession.provider.handleInteractiveEditorResponseFeedback?.(this._activeSession.session, this._activeSession.lastExchange.response.raw, kind); this._activeSession.provider.handleInlineChatResponseFeedback?.(this._activeSession.session, this._activeSession.lastExchange.response.raw, kind);
this._ctxLastFeedbackKind.set(helpful ? 'helpful' : 'unhelpful'); this._ctxLastFeedbackKind.set(helpful ? 'helpful' : 'unhelpful');
this._zone.value.widget.updateStatus('Thank you for your feedback!', { resetAfter: 1250 }); this._zone.value.widget.updateStatus('Thank you for your feedback!', { resetAfter: 1250 });
} }
@ -741,10 +741,10 @@ class StashedSession {
editor: ICodeEditor, editor: ICodeEditor,
session: Session, session: Session,
@IContextKeyService contextKeyService: IContextKeyService, @IContextKeyService contextKeyService: IContextKeyService,
@IInteractiveEditorSessionService private readonly _sessionService: IInteractiveEditorSessionService, @IInlineChatSessionService private readonly _sessionService: IInlineChatSessionService,
@ILogService private readonly _logService: ILogService, @ILogService private readonly _logService: ILogService,
) { ) {
this._ctxHasStashedSession = CTX_INTERACTIVE_EDITOR_HAS_STASHED_SESSION.bindTo(contextKeyService); this._ctxHasStashedSession = CTX_INLINE_CHAT_HAS_STASHED_SESSION.bindTo(contextKeyService);
// keep session for a little bit, only release when user continues to work (type, move cursor, etc.) // keep session for a little bit, only release when user continues to work (type, move cursor, etc.)
this._session = session; this._session = session;

View file

@ -16,7 +16,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import * as colorRegistry from 'vs/platform/theme/common/colorRegistry'; import * as colorRegistry from 'vs/platform/theme/common/colorRegistry';
import * as editorColorRegistry from 'vs/editor/common/core/editorColorRegistry'; import * as editorColorRegistry from 'vs/editor/common/core/editorColorRegistry';
import { IThemeService } from 'vs/platform/theme/common/themeService'; import { IThemeService } from 'vs/platform/theme/common/themeService';
import { INTERACTIVE_EDITOR_ID, interactiveEditorDiffInserted, interactiveEditorDiffRemoved, interactiveEditorRegionHighlight } from 'vs/workbench/contrib/inlineChat/common/inlineChat'; import { INLINE_CHAT_ID, inlineChatDiffInserted, inlineChatDiffRemoved, inlineChatRegionHighlight } from 'vs/workbench/contrib/inlineChat/common/inlineChat';
import { LineRange } from 'vs/editor/common/core/lineRange'; import { LineRange } from 'vs/editor/common/core/lineRange';
import { LineRangeMapping } from 'vs/editor/common/diff/linesDiffComputer'; import { LineRangeMapping } from 'vs/editor/common/diff/linesDiffComputer';
import { Position } from 'vs/editor/common/core/position'; import { Position } from 'vs/editor/common/core/position';
@ -32,7 +32,7 @@ import { IModelService } from 'vs/editor/common/services/model';
import { EditOperation } from 'vs/editor/common/core/editOperation'; import { EditOperation } from 'vs/editor/common/core/editOperation';
import { Session } from 'vs/workbench/contrib/inlineChat/browser/inlineChatSession'; import { Session } from 'vs/workbench/contrib/inlineChat/browser/inlineChatSession';
export class InteractiveEditorLivePreviewWidget extends ZoneWidget { export class InlineChatLivePreviewWidget extends ZoneWidget {
private static readonly _hideId = 'overlayDiff'; private static readonly _hideId = 'overlayDiff';
@ -59,7 +59,7 @@ export class InteractiveEditorLivePreviewWidget extends ZoneWidget {
const diffContributions = EditorExtensionsRegistry const diffContributions = EditorExtensionsRegistry
.getEditorContributions() .getEditorContributions()
.filter(c => c.id !== INTERACTIVE_EDITOR_ID); .filter(c => c.id !== INLINE_CHAT_ID);
this._diffEditor = instantiationService.createInstance(EmbeddedDiffEditorWidget, this._elements.domNode, { this._diffEditor = instantiationService.createInstance(EmbeddedDiffEditorWidget, this._elements.domNode, {
scrollbar: { useShadows: false, alwaysConsumeMouseWheel: false }, scrollbar: { useShadows: false, alwaysConsumeMouseWheel: false },
@ -88,12 +88,12 @@ export class InteractiveEditorLivePreviewWidget extends ZoneWidget {
const doStyle = () => { const doStyle = () => {
const theme = themeService.getColorTheme(); const theme = themeService.getColorTheme();
const overrides: [target: string, source: string][] = [ const overrides: [target: string, source: string][] = [
[colorRegistry.editorBackground, interactiveEditorRegionHighlight], [colorRegistry.editorBackground, inlineChatRegionHighlight],
[editorColorRegistry.editorGutter, interactiveEditorRegionHighlight], [editorColorRegistry.editorGutter, inlineChatRegionHighlight],
[colorRegistry.diffInsertedLine, interactiveEditorDiffInserted], [colorRegistry.diffInsertedLine, inlineChatDiffInserted],
[colorRegistry.diffInserted, interactiveEditorDiffInserted], [colorRegistry.diffInserted, inlineChatDiffInserted],
[colorRegistry.diffRemovedLine, interactiveEditorDiffRemoved], [colorRegistry.diffRemovedLine, inlineChatDiffRemoved],
[colorRegistry.diffRemoved, interactiveEditorDiffRemoved], [colorRegistry.diffRemoved, inlineChatDiffRemoved],
]; ];
for (const [target, source] of overrides) { for (const [target, source] of overrides) {
@ -244,9 +244,9 @@ export class InteractiveEditorLivePreviewWidget extends ZoneWidget {
} }
private _cleanupFullDiff() { private _cleanupFullDiff() {
this.editor.setHiddenAreas([], InteractiveEditorLivePreviewWidget._hideId); this.editor.setHiddenAreas([], InlineChatLivePreviewWidget._hideId);
this._diffEditor.getOriginalEditor().setHiddenAreas([], InteractiveEditorLivePreviewWidget._hideId); this._diffEditor.getOriginalEditor().setHiddenAreas([], InlineChatLivePreviewWidget._hideId);
this._diffEditor.getModifiedEditor().setHiddenAreas([], InteractiveEditorLivePreviewWidget._hideId); this._diffEditor.getModifiedEditor().setHiddenAreas([], InlineChatLivePreviewWidget._hideId);
super.hide(); super.hide();
} }
@ -292,7 +292,7 @@ export class InteractiveEditorLivePreviewWidget extends ZoneWidget {
return; return;
} }
const ranges = lineRanges.map(lineRangeAsRange); const ranges = lineRanges.map(lineRangeAsRange);
editor.setHiddenAreas(ranges, InteractiveEditorLivePreviewWidget._hideId); editor.setHiddenAreas(ranges, InlineChatLivePreviewWidget._hideId);
this._logService.debug(`[IE] diff HIDING ${ranges} for ${editor.getId()} with ${String(editor.getModel()?.uri)}`); this._logService.debug(`[IE] diff HIDING ${ranges} for ${editor.getId()} with ${String(editor.getModel()?.uri)}`);
} }
@ -334,7 +334,7 @@ function isInlineDiffFriendly(mapping: LineRangeMapping): boolean {
} }
export class InteractiveEditorFileCreatePreviewWidget extends ZoneWidget { export class InlineChatFileCreatePreviewWidget extends ZoneWidget {
private readonly _elements = h('div.interactive-editor-newfile-widget@domNode', [ private readonly _elements = h('div.interactive-editor-newfile-widget@domNode', [
h('div.title.show-file-icons@title'), h('div.title.show-file-icons@title'),
@ -368,8 +368,8 @@ export class InteractiveEditorFileCreatePreviewWidget extends ZoneWidget {
const doStyle = () => { const doStyle = () => {
const theme = themeService.getColorTheme(); const theme = themeService.getColorTheme();
const overrides: [target: string, source: string][] = [ const overrides: [target: string, source: string][] = [
[colorRegistry.editorBackground, interactiveEditorRegionHighlight], [colorRegistry.editorBackground, inlineChatRegionHighlight],
[editorColorRegistry.editorGutter, interactiveEditorRegionHighlight], [editorColorRegistry.editorGutter, inlineChatRegionHighlight],
]; ];
for (const [target, source] of overrides) { for (const [target, source] of overrides) {

View file

@ -6,14 +6,14 @@
import { illegalState } from 'vs/base/common/errors'; import { illegalState } from 'vs/base/common/errors';
import { Schemas } from 'vs/base/common/network'; import { Schemas } from 'vs/base/common/network';
import { isEqual } from 'vs/base/common/resources'; import { isEqual } from 'vs/base/common/resources';
import { IInteractiveEditorSessionService } from 'vs/workbench/contrib/inlineChat/browser/inlineChatSession'; import { IInlineChatSessionService } from 'vs/workbench/contrib/inlineChat/browser/inlineChatSession';
import { INotebookEditorService } from 'vs/workbench/contrib/notebook/browser/services/notebookEditorService'; import { INotebookEditorService } from 'vs/workbench/contrib/notebook/browser/services/notebookEditorService';
import { CellUri } from 'vs/workbench/contrib/notebook/common/notebookCommon'; import { CellUri } from 'vs/workbench/contrib/notebook/common/notebookCommon';
export class InteractiveEditorNotebookContribution { export class InlineChatNotebookContribution {
constructor( constructor(
@IInteractiveEditorSessionService sessionService: IInteractiveEditorSessionService, @IInlineChatSessionService sessionService: IInlineChatSessionService,
@INotebookEditorService notebookEditorService: INotebookEditorService, @INotebookEditorService notebookEditorService: INotebookEditorService,
) { ) {

View file

@ -9,7 +9,7 @@ import { Event } from 'vs/base/common/event';
import { ResourceEdit, ResourceFileEdit, ResourceTextEdit } from 'vs/editor/browser/services/bulkEditService'; import { ResourceEdit, ResourceFileEdit, ResourceTextEdit } from 'vs/editor/browser/services/bulkEditService';
import { TextEdit } from 'vs/editor/common/languages'; import { TextEdit } from 'vs/editor/common/languages';
import { IModelDeltaDecoration, ITextModel } from 'vs/editor/common/model'; import { IModelDeltaDecoration, ITextModel } from 'vs/editor/common/model';
import { EditMode, IInteractiveEditorSessionProvider, IInteractiveEditorSession, IInteractiveEditorBulkEditResponse, IInteractiveEditorEditResponse, IInteractiveEditorMessageResponse, IInteractiveEditorResponse, IInteractiveEditorService } from 'vs/workbench/contrib/inlineChat/common/inlineChat'; import { EditMode, IInlineChatSessionProvider, IInlineChatSession, IInlineChatBulkEditResponse, IInlineChatEditResponse, IInlineChatMessageResponse, IInlineChatResponse, IInlineChatService } from 'vs/workbench/contrib/inlineChat/common/inlineChat';
import { IRange, Range } from 'vs/editor/common/core/range'; import { IRange, Range } from 'vs/editor/common/core/range';
import { IActiveCodeEditor, ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { IActiveCodeEditor, ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
@ -28,8 +28,8 @@ import { ISingleEditOperation } from 'vs/editor/common/core/editOperation';
export type Recording = { export type Recording = {
when: Date; when: Date;
session: IInteractiveEditorSession; session: IInlineChatSession;
exchanges: { prompt: string; res: IInteractiveEditorResponse }[]; exchanges: { prompt: string; res: IInlineChatResponse }[];
}; };
type TelemetryData = { type TelemetryData = {
@ -124,8 +124,8 @@ export class Session {
readonly editor: ICodeEditor, readonly editor: ICodeEditor,
readonly textModel0: ITextModel, readonly textModel0: ITextModel,
readonly textModelN: ITextModel, readonly textModelN: ITextModel,
readonly provider: IInteractiveEditorSessionProvider, readonly provider: IInlineChatSessionProvider,
readonly session: IInteractiveEditorSession, readonly session: IInlineChatSession,
readonly wholeRange: SessionWholeRange readonly wholeRange: SessionWholeRange
) { ) {
this.textModelNAltVersion = textModelN.getAlternativeVersionId(); this.textModelNAltVersion = textModelN.getAlternativeVersionId();
@ -264,7 +264,7 @@ export class ErrorResponse {
export class MarkdownResponse { export class MarkdownResponse {
constructor( constructor(
readonly localUri: URI, readonly localUri: URI,
readonly raw: IInteractiveEditorMessageResponse readonly raw: IInlineChatMessageResponse
) { } ) { }
} }
@ -275,7 +275,7 @@ export class EditResponse {
readonly workspaceEdits: ResourceEdit[] | undefined; readonly workspaceEdits: ResourceEdit[] | undefined;
readonly workspaceEditsIncludeLocalEdits: boolean = false; readonly workspaceEditsIncludeLocalEdits: boolean = false;
constructor(localUri: URI, readonly raw: IInteractiveEditorBulkEditResponse | IInteractiveEditorEditResponse) { constructor(localUri: URI, readonly raw: IInlineChatBulkEditResponse | IInlineChatEditResponse) {
if (raw.type === 'editorEdit') { if (raw.type === 'editorEdit') {
// //
this.localEdits = raw.edits; this.localEdits = raw.edits;
@ -328,9 +328,9 @@ export interface ISessionKeyComputer {
getComparisonKey(editor: ICodeEditor, uri: URI): string; getComparisonKey(editor: ICodeEditor, uri: URI): string;
} }
export const IInteractiveEditorSessionService = createDecorator<IInteractiveEditorSessionService>('IInteractiveEditorSessionService'); export const IInlineChatSessionService = createDecorator<IInlineChatSessionService>('IInlineChatSessionService');
export interface IInteractiveEditorSessionService { export interface IInlineChatSessionService {
_serviceBrand: undefined; _serviceBrand: undefined;
createSession(editor: IActiveCodeEditor, options: { editMode: EditMode; wholeRange?: IRange }, token: CancellationToken): Promise<Session | undefined>; createSession(editor: IActiveCodeEditor, options: { editMode: EditMode; wholeRange?: IRange }, token: CancellationToken): Promise<Session | undefined>;
@ -351,7 +351,7 @@ type SessionData = {
store: IDisposable; store: IDisposable;
}; };
export class InteractiveEditorSessionService implements IInteractiveEditorSessionService { export class InlineChatSessionService implements IInlineChatSessionService {
declare _serviceBrand: undefined; declare _serviceBrand: undefined;
@ -360,7 +360,7 @@ export class InteractiveEditorSessionService implements IInteractiveEditorSessio
private _recordings: Recording[] = []; private _recordings: Recording[] = [];
constructor( constructor(
@IInteractiveEditorService private readonly _interactiveEditorService: IInteractiveEditorService, @IInlineChatService private readonly _inlineChatService: IInlineChatService,
@ITelemetryService private readonly _telemetryService: ITelemetryService, @ITelemetryService private readonly _telemetryService: ITelemetryService,
@IModelService private readonly _modelService: IModelService, @IModelService private readonly _modelService: IModelService,
@ITextModelService private readonly _textModelService: ITextModelService, @ITextModelService private readonly _textModelService: ITextModelService,
@ -370,7 +370,7 @@ export class InteractiveEditorSessionService implements IInteractiveEditorSessio
async createSession(editor: IActiveCodeEditor, options: { editMode: EditMode; wholeRange?: Range }, token: CancellationToken): Promise<Session | undefined> { async createSession(editor: IActiveCodeEditor, options: { editMode: EditMode; wholeRange?: Range }, token: CancellationToken): Promise<Session | undefined> {
const provider = Iterable.first(this._interactiveEditorService.getAllProvider()); const provider = Iterable.first(this._inlineChatService.getAllProvider());
if (!provider) { if (!provider) {
this._logService.trace('[IE] NO provider found'); this._logService.trace('[IE] NO provider found');
return undefined; return undefined;
@ -378,9 +378,9 @@ export class InteractiveEditorSessionService implements IInteractiveEditorSessio
const textModel = editor.getModel(); const textModel = editor.getModel();
const selection = editor.getSelection(); const selection = editor.getSelection();
let raw: IInteractiveEditorSession | undefined | null; let raw: IInlineChatSession | undefined | null;
try { try {
raw = await provider.prepareInteractiveEditorSession(textModel, selection, token); raw = await provider.prepareInlineChatSession(textModel, selection, token);
} catch (error) { } catch (error) {
this._logService.error('[IE] FAILED to prepare session', provider.debugName); this._logService.error('[IE] FAILED to prepare session', provider.debugName);
this._logService.error(error); this._logService.error(error);

View file

@ -19,10 +19,10 @@ import { localize } from 'vs/nls';
import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage'; import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage';
import { InteractiveEditorFileCreatePreviewWidget, InteractiveEditorLivePreviewWidget } from 'vs/workbench/contrib/inlineChat/browser/inlineChatLivePreviewWidget'; import { InlineChatFileCreatePreviewWidget, InlineChatLivePreviewWidget } from 'vs/workbench/contrib/inlineChat/browser/inlineChatLivePreviewWidget';
import { EditResponse, Session } from 'vs/workbench/contrib/inlineChat/browser/inlineChatSession'; import { EditResponse, Session } from 'vs/workbench/contrib/inlineChat/browser/inlineChatSession';
import { InteractiveEditorWidget } from 'vs/workbench/contrib/inlineChat/browser/inlineChatWidget'; import { InlineChatWidget } from 'vs/workbench/contrib/inlineChat/browser/inlineChatWidget';
import { CTX_INTERACTIVE_EDITOR_SHOWING_DIFF, CTX_INTERACTIVE_EDITOR_DOCUMENT_CHANGED } from 'vs/workbench/contrib/inlineChat/common/inlineChat'; import { CTX_INLINE_CHAT_SHOWING_DIFF, CTX_INLINE_CHAT_DOCUMENT_CHANGED } from 'vs/workbench/contrib/inlineChat/common/inlineChat';
import { IEditorService, SIDE_GROUP } from 'vs/workbench/services/editor/common/editorService'; import { IEditorService, SIDE_GROUP } from 'vs/workbench/services/editor/common/editorService';
export abstract class EditModeStrategy { export abstract class EditModeStrategy {
@ -49,14 +49,14 @@ export class PreviewStrategy extends EditModeStrategy {
constructor( constructor(
private readonly _session: Session, private readonly _session: Session,
private readonly _widget: InteractiveEditorWidget, private readonly _widget: InlineChatWidget,
@IContextKeyService contextKeyService: IContextKeyService, @IContextKeyService contextKeyService: IContextKeyService,
@IBulkEditService private readonly _bulkEditService: IBulkEditService, @IBulkEditService private readonly _bulkEditService: IBulkEditService,
@IInstantiationService private readonly _instaService: IInstantiationService, @IInstantiationService private readonly _instaService: IInstantiationService,
) { ) {
super(); super();
this._ctxDocumentChanged = CTX_INTERACTIVE_EDITOR_DOCUMENT_CHANGED.bindTo(contextKeyService); this._ctxDocumentChanged = CTX_INLINE_CHAT_DOCUMENT_CHANGED.bindTo(contextKeyService);
this._listener = Event.debounce(_session.textModelN.onDidChangeContent.bind(_session.textModelN), () => { }, 350)(_ => { this._listener = Event.debounce(_session.textModelN.onDidChangeContent.bind(_session.textModelN), () => { }, 350)(_ => {
this._ctxDocumentChanged.set(!_session.textModelN.equalsTextBuffer(_session.textModel0.getTextBuffer())); this._ctxDocumentChanged.set(!_session.textModelN.equalsTextBuffer(_session.textModel0.getTextBuffer()));
}); });
@ -208,7 +208,7 @@ export class LiveStrategy extends EditModeStrategy {
constructor( constructor(
protected readonly _session: Session, protected readonly _session: Session,
protected readonly _editor: ICodeEditor, protected readonly _editor: ICodeEditor,
protected readonly _widget: InteractiveEditorWidget, protected readonly _widget: InlineChatWidget,
@IContextKeyService contextKeyService: IContextKeyService, @IContextKeyService contextKeyService: IContextKeyService,
@IStorageService protected _storageService: IStorageService, @IStorageService protected _storageService: IStorageService,
@IBulkEditService protected readonly _bulkEditService: IBulkEditService, @IBulkEditService protected readonly _bulkEditService: IBulkEditService,
@ -219,7 +219,7 @@ export class LiveStrategy extends EditModeStrategy {
this._diffEnabled = _storageService.getBoolean(LiveStrategy._inlineDiffStorageKey, StorageScope.PROFILE, true); this._diffEnabled = _storageService.getBoolean(LiveStrategy._inlineDiffStorageKey, StorageScope.PROFILE, true);
this._inlineDiffDecorations = new InlineDiffDecorations(this._editor, this._diffEnabled); this._inlineDiffDecorations = new InlineDiffDecorations(this._editor, this._diffEnabled);
this._ctxShowingDiff = CTX_INTERACTIVE_EDITOR_SHOWING_DIFF.bindTo(contextKeyService); this._ctxShowingDiff = CTX_INLINE_CHAT_SHOWING_DIFF.bindTo(contextKeyService);
this._ctxShowingDiff.set(this._diffEnabled); this._ctxShowingDiff.set(this._diffEnabled);
this._inlineDiffDecorations.visible = this._diffEnabled; this._inlineDiffDecorations.visible = this._diffEnabled;
} }
@ -322,13 +322,13 @@ export class LiveStrategy extends EditModeStrategy {
export class LivePreviewStrategy extends LiveStrategy { export class LivePreviewStrategy extends LiveStrategy {
private readonly _diffZone: InteractiveEditorLivePreviewWidget; private readonly _diffZone: InlineChatLivePreviewWidget;
private readonly _previewZone: InteractiveEditorFileCreatePreviewWidget; private readonly _previewZone: InlineChatFileCreatePreviewWidget;
constructor( constructor(
session: Session, session: Session,
editor: ICodeEditor, editor: ICodeEditor,
widget: InteractiveEditorWidget, widget: InlineChatWidget,
@IContextKeyService contextKeyService: IContextKeyService, @IContextKeyService contextKeyService: IContextKeyService,
@IStorageService storageService: IStorageService, @IStorageService storageService: IStorageService,
@IBulkEditService bulkEditService: IBulkEditService, @IBulkEditService bulkEditService: IBulkEditService,
@ -337,8 +337,8 @@ export class LivePreviewStrategy extends LiveStrategy {
) { ) {
super(session, editor, widget, contextKeyService, storageService, bulkEditService, editorWorkerService, instaService); super(session, editor, widget, contextKeyService, storageService, bulkEditService, editorWorkerService, instaService);
this._diffZone = instaService.createInstance(InteractiveEditorLivePreviewWidget, editor, session); this._diffZone = instaService.createInstance(InlineChatLivePreviewWidget, editor, session);
this._previewZone = instaService.createInstance(InteractiveEditorFileCreatePreviewWidget, editor); this._previewZone = instaService.createInstance(InlineChatFileCreatePreviewWidget, editor);
} }
override dispose(): void { override dispose(): void {

View file

@ -12,7 +12,7 @@ import { localize } from 'vs/nls';
import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { ZoneWidget } from 'vs/editor/contrib/zoneWidget/browser/zoneWidget'; import { ZoneWidget } from 'vs/editor/contrib/zoneWidget/browser/zoneWidget';
import { CTX_INTERACTIVE_EDITOR_FOCUSED, CTX_INTERACTIVE_EDITOR_INNER_CURSOR_FIRST, CTX_INTERACTIVE_EDITOR_INNER_CURSOR_LAST, CTX_INTERACTIVE_EDITOR_EMPTY, CTX_INTERACTIVE_EDITOR_OUTER_CURSOR_POSITION, CTX_INTERACTIVE_EDITOR_VISIBLE, MENU_INTERACTIVE_EDITOR_WIDGET, MENU_INTERACTIVE_EDITOR_WIDGET_STATUS, MENU_INTERACTIVE_EDITOR_WIDGET_MARKDOWN_MESSAGE, CTX_INTERACTIVE_EDITOR_MESSAGE_CROP_STATE, IInteractiveEditorSlashCommand, MENU_INTERACTIVE_EDITOR_WIDGET_FEEDBACK, ACTION_ACCEPT_CHANGES } from 'vs/workbench/contrib/inlineChat/common/inlineChat'; import { CTX_INLINE_CHAT_FOCUSED, CTX_INLINE_CHAT_INNER_CURSOR_FIRST, CTX_INLINE_CHAT_INNER_CURSOR_LAST, CTX_INLINE_CHAT_EMPTY, CTX_INLINE_CHAT_OUTER_CURSOR_POSITION, CTX_INLINE_CHAT_VISIBLE, MENU_INLINE_CHAT_WIDGET, MENU_INLINE_CHAT_WIDGET_STATUS, MENU_INLINE_CHAT_WIDGET_MARKDOWN_MESSAGE, CTX_INLINE_CHAT_MESSAGE_CROP_STATE, IInlineChatSlashCommand, MENU_INLINE_CHAT_WIDGET_FEEDBACK, ACTION_ACCEPT_CHANGES } from 'vs/workbench/contrib/inlineChat/common/inlineChat';
import { IModelDeltaDecoration, ITextModel } from 'vs/editor/common/model'; import { IModelDeltaDecoration, ITextModel } from 'vs/editor/common/model';
import { Dimension, addDisposableListener, getTotalHeight, getTotalWidth, h, reset } from 'vs/base/browser/dom'; import { Dimension, addDisposableListener, getTotalHeight, getTotalWidth, h, reset } from 'vs/base/browser/dom';
import { Emitter, Event, MicrotaskEmitter } from 'vs/base/common/event'; import { Emitter, Event, MicrotaskEmitter } from 'vs/base/common/event';
@ -114,13 +114,13 @@ const _previewEditorEditorOptions: IDiffEditorConstructionOptions = {
isInEmbeddedEditor: true isInEmbeddedEditor: true
}; };
export interface InteractiveEditorWidgetViewState { export interface InlineChatWidgetViewState {
editorViewState: ICodeEditorViewState; editorViewState: ICodeEditorViewState;
input: string; input: string;
placeholder: string; placeholder: string;
} }
export class InteractiveEditorWidget { export class InlineChatWidget {
private static _modelPool: number = 1; private static _modelPool: number = 1;
@ -217,18 +217,18 @@ export class InteractiveEditorWidget {
} }
})); }));
const uri = URI.from({ scheme: 'vscode', authority: 'interactive-editor', path: `/interactive-editor/model${InteractiveEditorWidget._modelPool++}.txt` }); const uri = URI.from({ scheme: 'vscode', authority: 'interactive-editor', path: `/interactive-editor/model${InlineChatWidget._modelPool++}.txt` });
this._inputModel = this._modelService.getModel(uri) ?? this._modelService.createModel('', null, uri); this._inputModel = this._modelService.getModel(uri) ?? this._modelService.createModel('', null, uri);
this._inputEditor.setModel(this._inputModel); this._inputEditor.setModel(this._inputModel);
// --- context keys // --- context keys
this._ctxMessageCropState = CTX_INTERACTIVE_EDITOR_MESSAGE_CROP_STATE.bindTo(this._contextKeyService); this._ctxMessageCropState = CTX_INLINE_CHAT_MESSAGE_CROP_STATE.bindTo(this._contextKeyService);
this._ctxInputEmpty = CTX_INTERACTIVE_EDITOR_EMPTY.bindTo(this._contextKeyService); this._ctxInputEmpty = CTX_INLINE_CHAT_EMPTY.bindTo(this._contextKeyService);
this._ctxInnerCursorFirst = CTX_INTERACTIVE_EDITOR_INNER_CURSOR_FIRST.bindTo(this._contextKeyService); this._ctxInnerCursorFirst = CTX_INLINE_CHAT_INNER_CURSOR_FIRST.bindTo(this._contextKeyService);
this._ctxInnerCursorLast = CTX_INTERACTIVE_EDITOR_INNER_CURSOR_LAST.bindTo(this._contextKeyService); this._ctxInnerCursorLast = CTX_INLINE_CHAT_INNER_CURSOR_LAST.bindTo(this._contextKeyService);
this._ctxInputEditorFocused = CTX_INTERACTIVE_EDITOR_FOCUSED.bindTo(this._contextKeyService); this._ctxInputEditorFocused = CTX_INLINE_CHAT_FOCUSED.bindTo(this._contextKeyService);
// (1) inner cursor position (last/first line selected) // (1) inner cursor position (last/first line selected)
const updateInnerCursorFirstLast = () => { const updateInnerCursorFirstLast = () => {
@ -284,7 +284,7 @@ export class InteractiveEditorWidget {
// toolbars // toolbars
const toolbar = this._instantiationService.createInstance(MenuWorkbenchToolBar, this._elements.editorToolbar, MENU_INTERACTIVE_EDITOR_WIDGET, { const toolbar = this._instantiationService.createInstance(MenuWorkbenchToolBar, this._elements.editorToolbar, MENU_INLINE_CHAT_WIDGET, {
telemetrySource: 'interactiveEditorWidget-toolbar', telemetrySource: 'interactiveEditorWidget-toolbar',
toolbarOptions: { primaryGroup: 'main' } toolbarOptions: { primaryGroup: 'main' }
}); });
@ -333,11 +333,11 @@ export class InteractiveEditorWidget {
return createActionViewItem(this._instantiationService, action, options); return createActionViewItem(this._instantiationService, action, options);
} }
}; };
const statusToolbar = this._instantiationService.createInstance(MenuWorkbenchToolBar, this._elements.statusToolbar, MENU_INTERACTIVE_EDITOR_WIDGET_STATUS, { ...workbenchToolbarOptions, hiddenItemStrategy: HiddenItemStrategy.Ignore }); const statusToolbar = this._instantiationService.createInstance(MenuWorkbenchToolBar, this._elements.statusToolbar, MENU_INLINE_CHAT_WIDGET_STATUS, { ...workbenchToolbarOptions, hiddenItemStrategy: HiddenItemStrategy.Ignore });
this._store.add(statusToolbar.onDidChangeMenuItems(() => this._onDidChangeHeight.fire())); this._store.add(statusToolbar.onDidChangeMenuItems(() => this._onDidChangeHeight.fire()));
this._store.add(statusToolbar); this._store.add(statusToolbar);
const feedbackToolbar = this._instantiationService.createInstance(MenuWorkbenchToolBar, this._elements.feedbackToolbar, MENU_INTERACTIVE_EDITOR_WIDGET_FEEDBACK, { ...workbenchToolbarOptions, hiddenItemStrategy: HiddenItemStrategy.Ignore }); const feedbackToolbar = this._instantiationService.createInstance(MenuWorkbenchToolBar, this._elements.feedbackToolbar, MENU_INLINE_CHAT_WIDGET_FEEDBACK, { ...workbenchToolbarOptions, hiddenItemStrategy: HiddenItemStrategy.Ignore });
this._store.add(feedbackToolbar.onDidChangeMenuItems(() => this._onDidChangeHeight.fire())); this._store.add(feedbackToolbar.onDidChangeMenuItems(() => this._onDidChangeHeight.fire()));
this._store.add(feedbackToolbar); this._store.add(feedbackToolbar);
@ -349,7 +349,7 @@ export class InteractiveEditorWidget {
this._elements.message.tabIndex = 0; this._elements.message.tabIndex = 0;
this._elements.statusLabel.tabIndex = 0; this._elements.statusLabel.tabIndex = 0;
const markdownMessageToolbar = this._instantiationService.createInstance(MenuWorkbenchToolBar, this._elements.messageActions, MENU_INTERACTIVE_EDITOR_WIDGET_MARKDOWN_MESSAGE, workbenchToolbarOptions); const markdownMessageToolbar = this._instantiationService.createInstance(MenuWorkbenchToolBar, this._elements.messageActions, MENU_INLINE_CHAT_WIDGET_MARKDOWN_MESSAGE, workbenchToolbarOptions);
this._store.add(markdownMessageToolbar.onDidChangeMenuItems(() => this._onDidChangeHeight.fire())); this._store.add(markdownMessageToolbar.onDidChangeMenuItems(() => this._onDidChangeHeight.fire()));
this._store.add(markdownMessageToolbar); this._store.add(markdownMessageToolbar);
} }
@ -632,7 +632,7 @@ export class InteractiveEditorWidget {
// --- slash commands // --- slash commands
updateSlashCommands(commands: IInteractiveEditorSlashCommand[]) { updateSlashCommands(commands: IInlineChatSlashCommand[]) {
this._slashCommands.clear(); this._slashCommands.clear();
@ -643,7 +643,7 @@ export class InteractiveEditorWidget {
const selector: LanguageSelector = { scheme: this._inputModel.uri.scheme, pattern: this._inputModel.uri.path, language: this._inputModel.getLanguageId() }; const selector: LanguageSelector = { scheme: this._inputModel.uri.scheme, pattern: this._inputModel.uri.path, language: this._inputModel.getLanguageId() };
this._slashCommands.add(this._languageFeaturesService.completionProvider.register(selector, new class implements CompletionItemProvider { this._slashCommands.add(this._languageFeaturesService.completionProvider.register(selector, new class implements CompletionItemProvider {
_debugDisplayName?: string = 'InteractiveEditorSlashCommandProvider'; _debugDisplayName?: string = 'InlineChatSlashCommandProvider';
readonly triggerCharacters?: string[] = ['/']; readonly triggerCharacters?: string[] = ['/'];
@ -709,9 +709,9 @@ export class InteractiveEditorWidget {
} }
} }
export class InteractiveEditorZoneWidget extends ZoneWidget { export class InlineChatZoneWidget extends ZoneWidget {
readonly widget: InteractiveEditorWidget; readonly widget: InlineChatWidget;
private readonly _ctxVisible: IContextKey<boolean>; private readonly _ctxVisible: IContextKey<boolean>;
private readonly _ctxCursorPosition: IContextKey<'above' | 'below' | ''>; private readonly _ctxCursorPosition: IContextKey<'above' | 'below' | ''>;
@ -724,15 +724,15 @@ export class InteractiveEditorZoneWidget extends ZoneWidget {
) { ) {
super(editor, { showFrame: false, showArrow: false, isAccessible: true, className: 'interactive-editor-widget', keepEditorSelection: true, showInHiddenAreas: true, ordinal: 10000 + 3 }); super(editor, { showFrame: false, showArrow: false, isAccessible: true, className: 'interactive-editor-widget', keepEditorSelection: true, showInHiddenAreas: true, ordinal: 10000 + 3 });
this._ctxVisible = CTX_INTERACTIVE_EDITOR_VISIBLE.bindTo(contextKeyService); this._ctxVisible = CTX_INLINE_CHAT_VISIBLE.bindTo(contextKeyService);
this._ctxCursorPosition = CTX_INTERACTIVE_EDITOR_OUTER_CURSOR_POSITION.bindTo(contextKeyService); this._ctxCursorPosition = CTX_INLINE_CHAT_OUTER_CURSOR_POSITION.bindTo(contextKeyService);
this._disposables.add(toDisposable(() => { this._disposables.add(toDisposable(() => {
this._ctxVisible.reset(); this._ctxVisible.reset();
this._ctxCursorPosition.reset(); this._ctxCursorPosition.reset();
})); }));
this.widget = this._instaService.createInstance(InteractiveEditorWidget, this.editor); this.widget = this._instaService.createInstance(InlineChatWidget, this.editor);
this._disposables.add(this.widget.onDidChangeHeight(() => this._relayout())); this._disposables.add(this.widget.onDidChangeHeight(() => this._relayout()));
this._disposables.add(this.widget); this._disposables.add(this.widget);
this.create(); this.create();

View file

@ -18,104 +18,104 @@ import { createDecorator } from 'vs/platform/instantiation/common/instantiation'
import { Registry } from 'vs/platform/registry/common/platform'; import { Registry } from 'vs/platform/registry/common/platform';
import { diffInserted, diffRemoved, editorHoverHighlight, editorWidgetBorder, focusBorder, inputBackground, inputPlaceholderForeground, registerColor, transparent, widgetShadow } from 'vs/platform/theme/common/colorRegistry'; import { diffInserted, diffRemoved, editorHoverHighlight, editorWidgetBorder, focusBorder, inputBackground, inputPlaceholderForeground, registerColor, transparent, widgetShadow } from 'vs/platform/theme/common/colorRegistry';
export interface IInteractiveEditorSlashCommand { export interface IInlineChatSlashCommand {
command: string; command: string;
detail?: string; detail?: string;
refer?: boolean; refer?: boolean;
} }
export interface IInteractiveEditorSession { export interface IInlineChatSession {
id: number; id: number;
placeholder?: string; placeholder?: string;
message?: string; message?: string;
slashCommands?: IInteractiveEditorSlashCommand[]; slashCommands?: IInlineChatSlashCommand[];
wholeRange?: IRange; wholeRange?: IRange;
dispose?(): void; dispose?(): void;
} }
export interface IInteractiveEditorRequest { export interface IInlineChatRequest {
prompt: string; prompt: string;
selection: ISelection; selection: ISelection;
wholeRange: IRange; wholeRange: IRange;
attempt: number; attempt: number;
} }
export type IInteractiveEditorResponse = IInteractiveEditorEditResponse | IInteractiveEditorBulkEditResponse | IInteractiveEditorMessageResponse; export type IInlineChatResponse = IInlineChatEditResponse | IInlineChatBulkEditResponse | IInlineChatMessageResponse;
export const enum InteractiveEditorResponseType { export const enum InlineChatResponseType {
EditorEdit = 'editorEdit', EditorEdit = 'editorEdit',
BulkEdit = 'bulkEdit', BulkEdit = 'bulkEdit',
Message = 'message' Message = 'message'
} }
export interface IInteractiveEditorEditResponse { export interface IInlineChatEditResponse {
id: number; id: number;
type: InteractiveEditorResponseType.EditorEdit; type: InlineChatResponseType.EditorEdit;
edits: TextEdit[]; edits: TextEdit[];
placeholder?: string; placeholder?: string;
wholeRange?: IRange; wholeRange?: IRange;
} }
export interface IInteractiveEditorBulkEditResponse { export interface IInlineChatBulkEditResponse {
id: number; id: number;
type: InteractiveEditorResponseType.BulkEdit; type: InlineChatResponseType.BulkEdit;
edits: WorkspaceEdit; edits: WorkspaceEdit;
placeholder?: string; placeholder?: string;
wholeRange?: IRange; wholeRange?: IRange;
} }
export interface IInteractiveEditorMessageResponse { export interface IInlineChatMessageResponse {
id: number; id: number;
type: InteractiveEditorResponseType.Message; type: InlineChatResponseType.Message;
message: IMarkdownString; message: IMarkdownString;
placeholder?: string; placeholder?: string;
wholeRange?: IRange; wholeRange?: IRange;
} }
export const enum InteractiveEditorResponseFeedbackKind { export const enum InlineChatResponseFeedbackKind {
Unhelpful = 0, Unhelpful = 0,
Helpful = 1, Helpful = 1,
Undone = 2 Undone = 2
} }
export interface IInteractiveEditorSessionProvider { export interface IInlineChatSessionProvider {
debugName: string; debugName: string;
prepareInteractiveEditorSession(model: ITextModel, range: ISelection, token: CancellationToken): ProviderResult<IInteractiveEditorSession>; prepareInlineChatSession(model: ITextModel, range: ISelection, token: CancellationToken): ProviderResult<IInlineChatSession>;
provideResponse(item: IInteractiveEditorSession, request: IInteractiveEditorRequest, token: CancellationToken): ProviderResult<IInteractiveEditorResponse>; provideResponse(item: IInlineChatSession, request: IInlineChatRequest, token: CancellationToken): ProviderResult<IInlineChatResponse>;
handleInteractiveEditorResponseFeedback?(session: IInteractiveEditorSession, response: IInteractiveEditorResponse, kind: InteractiveEditorResponseFeedbackKind): void; handleInlineChatResponseFeedback?(session: IInlineChatSession, response: IInlineChatResponse, kind: InlineChatResponseFeedbackKind): void;
} }
export const IInteractiveEditorService = createDecorator<IInteractiveEditorService>('IInteractiveEditorService'); export const IInlineChatService = createDecorator<IInlineChatService>('IInlineChatService');
export interface IInteractiveEditorService { export interface IInlineChatService {
_serviceBrand: undefined; _serviceBrand: undefined;
addProvider(provider: IInteractiveEditorSessionProvider): IDisposable; addProvider(provider: IInlineChatSessionProvider): IDisposable;
getAllProvider(): Iterable<IInteractiveEditorSessionProvider>; getAllProvider(): Iterable<IInlineChatSessionProvider>;
} }
export const INTERACTIVE_EDITOR_ID = 'interactiveEditor'; export const INLINE_CHAT_ID = 'interactiveEDitor';
export const CTX_INTERACTIVE_EDITOR_HAS_PROVIDER = new RawContextKey<boolean>('interactiveEditorHasProvider', false, localize('interactiveEditorHasProvider', "Whether a provider for interactive editors exists")); export const CTX_INLINE_CHAT_HAS_PROVIDER = new RawContextKey<boolean>('inlineChatHasProvider', false, localize('inlineChatHasProvider', "Whether a provider for interactive editors exists"));
export const CTX_INTERACTIVE_EDITOR_VISIBLE = new RawContextKey<boolean>('interactiveEditorVisible', false, localize('interactiveEditorVisible', "Whether the interactive editor input is visible")); export const CTX_INLINE_CHAT_VISIBLE = new RawContextKey<boolean>('inlineChatVisible', false, localize('inlineChatVisible', "Whether the interactive editor input is visible"));
export const CTX_INTERACTIVE_EDITOR_FOCUSED = new RawContextKey<boolean>('interactiveEditorFocused', false, localize('interactiveEditorFocused', "Whether the interactive editor input is focused")); export const CTX_INLINE_CHAT_FOCUSED = new RawContextKey<boolean>('inlineChatFocused', false, localize('inlineChatFocused', "Whether the interactive editor input is focused"));
export const CTX_INTERACTIVE_EDITOR_EMPTY = new RawContextKey<boolean>('interactiveEditorEmpty', false, localize('interactiveEditorEmpty', "Whether the interactive editor input is empty")); export const CTX_INLINE_CHAT_EMPTY = new RawContextKey<boolean>('inlineChatEmpty', false, localize('inlineChatEmpty', "Whether the interactive editor input is empty"));
export const CTX_INTERACTIVE_EDITOR_INNER_CURSOR_FIRST = new RawContextKey<boolean>('interactiveEditorInnerCursorFirst', false, localize('interactiveEditorInnerCursorFirst', "Whether the cursor of the iteractive editor input is on the first line")); export const CTX_INLINE_CHAT_INNER_CURSOR_FIRST = new RawContextKey<boolean>('inlineChatInnerCursorFirst', false, localize('inlineChatInnerCursorFirst', "Whether the cursor of the iteractive editor input is on the first line"));
export const CTX_INTERACTIVE_EDITOR_INNER_CURSOR_LAST = new RawContextKey<boolean>('interactiveEditorInnerCursorLast', false, localize('interactiveEditorInnerCursorLast', "Whether the cursor of the iteractive editor input is on the last line")); export const CTX_INLINE_CHAT_INNER_CURSOR_LAST = new RawContextKey<boolean>('inlineChatInnerCursorLast', false, localize('inlineChatInnerCursorLast', "Whether the cursor of the iteractive editor input is on the last line"));
export const CTX_INTERACTIVE_EDITOR_MESSAGE_CROP_STATE = new RawContextKey<'cropped' | 'not_cropped' | 'expanded'>('interactiveEditorMarkdownMessageCropState', 'not_cropped', localize('interactiveEditorMarkdownMessageCropState', "Whether the interactive editor message is cropped, not cropped or expanded")); export const CTX_INLINE_CHAT_MESSAGE_CROP_STATE = new RawContextKey<'cropped' | 'not_cropped' | 'expanded'>('inlineChatMarkdownMessageCropState', 'not_cropped', localize('inlineChatMarkdownMessageCropState', "Whether the interactive editor message is cropped, not cropped or expanded"));
export const CTX_INTERACTIVE_EDITOR_OUTER_CURSOR_POSITION = new RawContextKey<'above' | 'below' | ''>('interactiveEditorOuterCursorPosition', '', localize('interactiveEditorOuterCursorPosition', "Whether the cursor of the outer editor is above or below the interactive editor 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_INTERACTIVE_EDITOR_HAS_ACTIVE_REQUEST = new RawContextKey<boolean>('interactiveEditorHasActiveRequest', false, localize('interactiveEditorHasActiveRequest', "Whether interactive editor has an active request")); 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_INTERACTIVE_EDITOR_HAS_STASHED_SESSION = new RawContextKey<boolean>('interactiveEditorHasStashedSession', false, localize('interactiveEditorHasStashedSession', "Whether interactive editor has kept a session for quick restore")); 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_INTERACTIVE_EDITOR_SHOWING_DIFF = new RawContextKey<boolean>('interactiveEditorDiff', false, localize('interactiveEditorDiff', "Whether interactive editor show diffs for changes")); export const CTX_INLINE_CHAT_SHOWING_DIFF = new RawContextKey<boolean>('inlineChatDiff', false, localize('inlineChatDiff', "Whether interactive editor show diffs for changes"));
export const CTX_INTERACTIVE_EDITOR_LAST_RESPONSE_TYPE = new RawContextKey<InteractiveEditorResponseType | undefined>('interactiveEditorLastResponseType', undefined, localize('interactiveEditorResponseType', "What type was the last response of the current interactive editor session")); export const CTX_INLINE_CHAT_LAST_RESPONSE_TYPE = new RawContextKey<InlineChatResponseType | undefined>('inlineChatLastResponseType', undefined, localize('inlineChatResponseType', "What type was the last response of the current interactive editor session"));
export const CTX_INTERACTIVE_EDITOR_DID_EDIT = new RawContextKey<boolean>('interactiveEditorDidEdit', false, localize('interactiveEditorDidEdit', "Whether interactive editor did change any code")); export const CTX_INLINE_CHAT_DID_EDIT = new RawContextKey<boolean>('inlineChatDidEdit', false, localize('inlineChatDidEdit', "Whether interactive editor did change any code"));
export const CTX_INTERACTIVE_EDITOR_LAST_FEEDBACK = new RawContextKey<'unhelpful' | 'helpful' | ''>('interactiveEditorLastFeedbackKind', '', localize('interactiveEditorLastFeedbackKind', "The last kind of feedback that was provided")); 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_INTERACTIVE_EDITOR_DOCUMENT_CHANGED = new RawContextKey<boolean>('interactiveEditorDocumentChanged', false, localize('interactiveEditorDocumentChanged', "Whether the document has changed concurrently")); export const CTX_INLINE_CHAT_DOCUMENT_CHANGED = new RawContextKey<boolean>('inlineChatDocumentChanged', false, localize('inlineChatDocumentChanged', "Whether the document has changed concurrently"));
export const CTX_INTERACTIVE_EDITOR_EDIT_MODE = new RawContextKey<EditMode>('config.interactiveEditor.editMode', EditMode.Live); export const CTX_INLINE_CHAT_EDIT_MODE = new RawContextKey<EditMode>('config.inlineChat.editMode', EditMode.Live);
// --- (select) action identifier // --- (select) action identifier
@ -123,24 +123,24 @@ export const ACTION_ACCEPT_CHANGES = 'interactive.acceptChanges';
// --- menus // --- menus
export const MENU_INTERACTIVE_EDITOR_WIDGET = MenuId.for('interactiveEditorWidget'); export const MENU_INLINE_CHAT_WIDGET = MenuId.for('inlineChatWidget');
export const MENU_INTERACTIVE_EDITOR_WIDGET_MARKDOWN_MESSAGE = MenuId.for('interactiveEditorWidget.markdownMessage'); export const MENU_INLINE_CHAT_WIDGET_MARKDOWN_MESSAGE = MenuId.for('inlineChatWidget.markdownMessage');
export const MENU_INTERACTIVE_EDITOR_WIDGET_STATUS = MenuId.for('interactiveEditorWidget.status'); export const MENU_INLINE_CHAT_WIDGET_STATUS = MenuId.for('inlineChatWidget.status');
export const MENU_INTERACTIVE_EDITOR_WIDGET_FEEDBACK = MenuId.for('interactiveEditorWidget.feedback'); export const MENU_INLINE_CHAT_WIDGET_FEEDBACK = MenuId.for('inlineChatWidget.feedback');
export const MENU_INTERACTIVE_EDITOR_WIDGET_DISCARD = MenuId.for('interactiveEditorWidget.undo'); export const MENU_INLINE_CHAT_WIDGET_DISCARD = MenuId.for('inlineChatWidget.undo');
// --- colors // --- colors
export const interactiveEditorBorder = registerColor('interactiveEditor.border', { dark: editorWidgetBorder, light: editorWidgetBorder, hcDark: editorWidgetBorder, hcLight: editorWidgetBorder }, localize('interactiveEditor.border', "Border color of the interactive editor widget")); export const inlineChatBorder = registerColor('inlineChat.border', { dark: editorWidgetBorder, light: editorWidgetBorder, hcDark: editorWidgetBorder, hcLight: editorWidgetBorder }, localize('inlineChat.border', "Border color of the interactive editor widget"));
export const interactiveEditorShadow = registerColor('interactiveEditor.shadow', { dark: widgetShadow, light: widgetShadow, hcDark: widgetShadow, hcLight: widgetShadow }, localize('interactiveEditor.shadow', "Shadow color of the interactive editor widget")); export const inlineChatShadow = registerColor('inlineChat.shadow', { dark: widgetShadow, light: widgetShadow, hcDark: widgetShadow, hcLight: widgetShadow }, localize('inlineChat.shadow', "Shadow color of the interactive editor widget"));
export const interactiveEditorRegionHighlight = registerColor('interactiveEditor.regionHighlight', { dark: editorHoverHighlight, light: editorHoverHighlight, hcDark: editorHoverHighlight, hcLight: editorHoverHighlight }, localize('interactiveEditor.regionHighlight', "Background highlighting of the current interactive region. Must be transparent."), true); export const inlineChatRegionHighlight = registerColor('inlineChat.regionHighlight', { dark: editorHoverHighlight, light: editorHoverHighlight, hcDark: editorHoverHighlight, hcLight: editorHoverHighlight }, localize('inlineChat.regionHighlight', "Background highlighting of the current interactive region. Must be transparent."), true);
export const interactiveEditorInputBorder = registerColor('interactiveEditorInput.border', { dark: editorWidgetBorder, light: editorWidgetBorder, hcDark: editorWidgetBorder, hcLight: editorWidgetBorder }, localize('interactiveEditorInput.border', "Border color of the interactive editor input")); export const inlineChatInputBorder = registerColor('inlineChatInput.border', { dark: editorWidgetBorder, light: editorWidgetBorder, hcDark: editorWidgetBorder, hcLight: editorWidgetBorder }, localize('inlineChatInput.border', "Border color of the interactive editor input"));
export const interactiveEditorInputFocusBorder = registerColor('interactiveEditorInput.focusBorder', { dark: focusBorder, light: focusBorder, hcDark: focusBorder, hcLight: focusBorder }, localize('interactiveEditorInput.focusBorder', "Border color of the interactive editor input when focused")); export const inlineChatInputFocusBorder = registerColor('inlineChatInput.focusBorder', { dark: focusBorder, light: focusBorder, hcDark: focusBorder, hcLight: focusBorder }, localize('inlineChatInput.focusBorder', "Border color of the interactive editor input when focused"));
export const interactiveEditorInputPlaceholderForeground = registerColor('interactiveEditorInput.placeholderForeground', { dark: inputPlaceholderForeground, light: inputPlaceholderForeground, hcDark: inputPlaceholderForeground, hcLight: inputPlaceholderForeground }, localize('interactiveEditorInput.placeholderForeground', "Foreground color of the interactive editor input placeholder")); export const inlineChatInputPlaceholderForeground = registerColor('inlineChatInput.placeholderForeground', { dark: inputPlaceholderForeground, light: inputPlaceholderForeground, hcDark: inputPlaceholderForeground, hcLight: inputPlaceholderForeground }, localize('inlineChatInput.placeholderForeground', "Foreground color of the interactive editor input placeholder"));
export const interactiveEditorInputBackground = registerColor('interactiveEditorInput.background', { dark: inputBackground, light: inputBackground, hcDark: inputBackground, hcLight: inputBackground }, localize('interactiveEditorInput.background', "Background color of the interactive editor input")); export const inlineChatInputBackground = registerColor('inlineChatInput.background', { dark: inputBackground, light: inputBackground, hcDark: inputBackground, hcLight: inputBackground }, localize('inlineChatInput.background', "Background color of the interactive editor input"));
export const interactiveEditorDiffInserted = registerColor('interactiveEditorDiff.inserted', { dark: transparent(diffInserted, .5), light: transparent(diffInserted, .5), hcDark: transparent(diffInserted, .5), hcLight: transparent(diffInserted, .5) }, localize('interactiveEditorDiff.inserted', "Background color of inserted text in the interactive editor input")); export const inlineChatDiffInserted = registerColor('inlineChatDiff.inserted', { dark: transparent(diffInserted, .5), light: transparent(diffInserted, .5), hcDark: transparent(diffInserted, .5), hcLight: transparent(diffInserted, .5) }, localize('inlineChatDiff.inserted', "Background color of inserted text in the interactive editor input"));
export const interactiveEditorDiffRemoved = registerColor('interactiveEditorDiff.removed', { dark: transparent(diffRemoved, .5), light: transparent(diffRemoved, .5), hcDark: transparent(diffRemoved, .5), hcLight: transparent(diffRemoved, .5) }, localize('interactiveEditorDiff.removed', "Background color of removed text in the interactive editor input")); export const inlineChatDiffRemoved = registerColor('inlineChatrDiff.removed', { dark: transparent(diffRemoved, .5), light: transparent(diffRemoved, .5), hcDark: transparent(diffRemoved, .5), hcLight: transparent(diffRemoved, .5) }, localize('inlineChatDiff.removed', "Background color of removed text in the interactive editor input"));
// settings // settings

View file

@ -6,21 +6,21 @@
import { IDisposable, toDisposable } from 'vs/base/common/lifecycle'; import { IDisposable, toDisposable } from 'vs/base/common/lifecycle';
import { LinkedList } from 'vs/base/common/linkedList'; import { LinkedList } from 'vs/base/common/linkedList';
import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IInteractiveEditorService, IInteractiveEditorSessionProvider, CTX_INTERACTIVE_EDITOR_HAS_PROVIDER } from './inlineChat'; import { IInlineChatService, IInlineChatSessionProvider, CTX_INLINE_CHAT_HAS_PROVIDER } from './inlineChat';
export class InteractiveEditorServiceImpl implements IInteractiveEditorService { export class InlineChatServiceImpl implements IInlineChatService {
declare _serviceBrand: undefined; declare _serviceBrand: undefined;
private readonly _entries = new LinkedList<IInteractiveEditorSessionProvider>(); private readonly _entries = new LinkedList<IInlineChatSessionProvider>();
private readonly _ctxHasProvider: IContextKey<boolean>; private readonly _ctxHasProvider: IContextKey<boolean>;
constructor(@IContextKeyService contextKeyService: IContextKeyService) { constructor(@IContextKeyService contextKeyService: IContextKeyService) {
this._ctxHasProvider = CTX_INTERACTIVE_EDITOR_HAS_PROVIDER.bindTo(contextKeyService); this._ctxHasProvider = CTX_INLINE_CHAT_HAS_PROVIDER.bindTo(contextKeyService);
} }
addProvider(provider: IInteractiveEditorSessionProvider): IDisposable { addProvider(provider: IInlineChatSessionProvider): IDisposable {
const rm = this._entries.push(provider); const rm = this._entries.push(provider);
this._ctxHasProvider.set(true); this._ctxHasProvider.set(true);

View file

@ -10,10 +10,10 @@ import { Range } from 'vs/editor/common/core/range';
import { instantiateTestCodeEditor } from 'vs/editor/test/browser/testCodeEditor'; import { instantiateTestCodeEditor } from 'vs/editor/test/browser/testCodeEditor';
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors'; import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection'; import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
import { InteractiveEditorController, InteractiveEditorRunOptions, State } from 'vs/workbench/contrib/inlineChat/browser/inlineChatController'; import { InlineChatController, InlineChatRunOptions, State } from 'vs/workbench/contrib/inlineChat/browser/inlineChatController';
import { IInteractiveEditorSessionService, InteractiveEditorSessionService } from 'vs/workbench/contrib/inlineChat/browser/inlineChatSession'; import { IInlineChatSessionService, InlineChatSessionService } from 'vs/workbench/contrib/inlineChat/browser/inlineChatSession';
import { IInteractiveEditorService, InteractiveEditorResponseType } from 'vs/workbench/contrib/inlineChat/common/inlineChat'; import { IInlineChatService, InlineChatResponseType } from 'vs/workbench/contrib/inlineChat/common/inlineChat';
import { InteractiveEditorServiceImpl } from 'vs/workbench/contrib/inlineChat/common/inlineChatServiceImpl'; import { InlineChatServiceImpl } from 'vs/workbench/contrib/inlineChat/common/inlineChatServiceImpl';
import { workbenchInstantiationService } from 'vs/workbench/test/browser/workbenchTestServices'; import { workbenchInstantiationService } from 'vs/workbench/test/browser/workbenchTestServices';
import { MockContextKeyService } from 'vs/platform/keybinding/test/common/mockKeybindingService'; import { MockContextKeyService } from 'vs/platform/keybinding/test/common/mockKeybindingService';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
@ -26,9 +26,9 @@ import { Emitter, Event } from 'vs/base/common/event';
import { equals } from 'vs/base/common/arrays'; import { equals } from 'vs/base/common/arrays';
import { timeout } from 'vs/base/common/async'; import { timeout } from 'vs/base/common/async';
suite('InteractiveEditorController', function () { suite('InteractiveChatontroller', function () {
class TestController extends InteractiveEditorController { class TestController extends InlineChatController {
static INIT_SEQUENCE: readonly State[] = [State.CREATE_SESSION, State.INIT_UI, State.WAIT_FOR_INPUT]; static INIT_SEQUENCE: readonly State[] = [State.CREATE_SESSION, State.INIT_UI, State.WAIT_FOR_INPUT];
static INIT_SEQUENCE_AUTO_SEND: readonly State[] = [...this.INIT_SEQUENCE, State.MAKE_REQUEST, State.APPLY_RESPONSE, State.SHOW_RESPONSE, State.WAIT_FOR_INPUT]; static INIT_SEQUENCE_AUTO_SEND: readonly State[] = [...this.INIT_SEQUENCE, State.MAKE_REQUEST, State.APPLY_RESPONSE, State.SHOW_RESPONSE, State.WAIT_FOR_INPUT];
@ -57,7 +57,7 @@ suite('InteractiveEditorController', function () {
}); });
} }
protected override _nextState(state: State, options: InteractiveEditorRunOptions | undefined): Promise<void> { protected override _nextState(state: State, options: InlineChatRunOptions | undefined): Promise<void> {
this._onDidChangeState.fire(state); this._onDidChangeState.fire(state);
(<State[]>this.states).push(state); (<State[]>this.states).push(state);
return super._nextState(state, options); return super._nextState(state, options);
@ -74,19 +74,19 @@ suite('InteractiveEditorController', function () {
let model: ITextModel; let model: ITextModel;
let ctrl: TestController; let ctrl: TestController;
// let contextKeys: MockContextKeyService; // let contextKeys: MockContextKeyService;
let interactiveEditorService: InteractiveEditorServiceImpl; let inlineChatService: InlineChatServiceImpl;
let interactiveEditorSessionService: IInteractiveEditorSessionService; let inlineChatSessionService: IInlineChatSessionService;
let instaService: TestInstantiationService; let instaService: TestInstantiationService;
setup(function () { setup(function () {
const contextKeyService = new MockContextKeyService(); const contextKeyService = new MockContextKeyService();
interactiveEditorService = new InteractiveEditorServiceImpl(contextKeyService); inlineChatService = new InlineChatServiceImpl(contextKeyService);
const serviceCollection = new ServiceCollection( const serviceCollection = new ServiceCollection(
[IContextKeyService, contextKeyService], [IContextKeyService, contextKeyService],
[IInteractiveEditorService, interactiveEditorService], [IInlineChatService, inlineChatService],
[IInteractiveEditorSessionService, new SyncDescriptor(InteractiveEditorSessionService)], [IInlineChatSessionService, new SyncDescriptor(InlineChatSessionService)],
[IEditorProgressService, new class extends mock<IEditorProgressService>() { [IEditorProgressService, new class extends mock<IEditorProgressService>() {
override show(total: unknown, delay?: unknown): IProgressRunner { override show(total: unknown, delay?: unknown): IProgressRunner {
return { return {
@ -99,21 +99,21 @@ suite('InteractiveEditorController', function () {
); );
instaService = workbenchInstantiationService(undefined, store).createChild(serviceCollection); instaService = workbenchInstantiationService(undefined, store).createChild(serviceCollection);
interactiveEditorSessionService = instaService.get(IInteractiveEditorSessionService); inlineChatSessionService = instaService.get(IInlineChatSessionService);
model = instaService.get(IModelService).createModel('Hello\nWorld\nHello Again\nHello World\n', null); model = instaService.get(IModelService).createModel('Hello\nWorld\nHello Again\nHello World\n', null);
editor = instantiateTestCodeEditor(instaService, model); editor = instantiateTestCodeEditor(instaService, model);
store.add(interactiveEditorService.addProvider({ store.add(inlineChatService.addProvider({
debugName: 'Unit Test', debugName: 'Unit Test',
prepareInteractiveEditorSession() { prepareInlineChatSession() {
return { return {
id: Math.random() id: Math.random()
}; };
}, },
provideResponse(session, request) { provideResponse(session, request) {
return { return {
type: InteractiveEditorResponseType.EditorEdit, type: InlineChatResponseType.EditorEdit,
id: Math.random(), id: Math.random(),
edits: [{ edits: [{
range: new Range(1, 1, 1, 1), range: new Range(1, 1, 1, 1),
@ -155,9 +155,9 @@ suite('InteractiveEditorController', function () {
editor.setSelection(new Range(1, 1, 1, 3)); editor.setSelection(new Range(1, 1, 1, 3));
ctrl = instaService.createInstance(TestController, editor); ctrl = instaService.createInstance(TestController, editor);
const d = interactiveEditorService.addProvider({ const d = inlineChatService.addProvider({
debugName: 'Unit Test', debugName: 'Unit Test',
prepareInteractiveEditorSession() { prepareInlineChatSession() {
return { return {
id: Math.random() id: Math.random()
}; };
@ -170,7 +170,7 @@ suite('InteractiveEditorController', function () {
ctrl.run({}); ctrl.run({});
await Event.toPromise(Event.filter(ctrl.onDidChangeState, e => e === State.WAIT_FOR_INPUT)); await Event.toPromise(Event.filter(ctrl.onDidChangeState, e => e === State.WAIT_FOR_INPUT));
const session = interactiveEditorSessionService.getSession(editor, editor.getModel()!.uri); const session = inlineChatSessionService.getSession(editor, editor.getModel()!.uri);
assert.ok(session); assert.ok(session);
assert.deepStrictEqual(session.wholeRange.value, new Range(1, 1, 1, 6)); assert.deepStrictEqual(session.wholeRange.value, new Range(1, 1, 1, 6));
@ -183,9 +183,9 @@ suite('InteractiveEditorController', function () {
editor.setSelection(new Range(1, 1, 1, 1)); editor.setSelection(new Range(1, 1, 1, 1));
ctrl = instaService.createInstance(TestController, editor); ctrl = instaService.createInstance(TestController, editor);
const d = interactiveEditorService.addProvider({ const d = inlineChatService.addProvider({
debugName: 'Unit Test', debugName: 'Unit Test',
prepareInteractiveEditorSession() { prepareInlineChatSession() {
return { return {
id: Math.random(), id: Math.random(),
wholeRange: new Range(1, 1, 1, 3) wholeRange: new Range(1, 1, 1, 3)
@ -199,7 +199,7 @@ suite('InteractiveEditorController', function () {
ctrl.run({}); ctrl.run({});
await Event.toPromise(Event.filter(ctrl.onDidChangeState, e => e === State.WAIT_FOR_INPUT)); await Event.toPromise(Event.filter(ctrl.onDidChangeState, e => e === State.WAIT_FOR_INPUT));
const session = interactiveEditorSessionService.getSession(editor, editor.getModel()!.uri); const session = inlineChatSessionService.getSession(editor, editor.getModel()!.uri);
assert.ok(session); assert.ok(session);
assert.deepStrictEqual(session.wholeRange.value, new Range(1, 1, 1, 6)); assert.deepStrictEqual(session.wholeRange.value, new Range(1, 1, 1, 6));
@ -213,7 +213,7 @@ suite('InteractiveEditorController', function () {
await ctrl.waitFor(TestController.INIT_SEQUENCE_AUTO_SEND); await ctrl.waitFor(TestController.INIT_SEQUENCE_AUTO_SEND);
const session = interactiveEditorSessionService.getSession(editor, editor.getModel()!.uri); const session = inlineChatSessionService.getSession(editor, editor.getModel()!.uri);
assert.ok(session); assert.ok(session);
assert.deepStrictEqual(session.wholeRange.value, new Range(1, 1, 1, 11)); assert.deepStrictEqual(session.wholeRange.value, new Range(1, 1, 1, 11));
@ -227,9 +227,9 @@ suite('InteractiveEditorController', function () {
editor.setSelection(new Range(3, 1, 3, 1)); editor.setSelection(new Range(3, 1, 3, 1));
const d = interactiveEditorService.addProvider({ const d = inlineChatService.addProvider({
debugName: 'Unit Test', debugName: 'Unit Test',
prepareInteractiveEditorSession() { prepareInlineChatSession() {
return { return {
id: Math.random(), id: Math.random(),
wholeRange: new Range(3, 1, 3, 3) wholeRange: new Range(3, 1, 3, 3)
@ -237,7 +237,7 @@ suite('InteractiveEditorController', function () {
}, },
provideResponse(session, request) { provideResponse(session, request) {
return { return {
type: InteractiveEditorResponseType.EditorEdit, type: InlineChatResponseType.EditorEdit,
id: Math.random(), id: Math.random(),
edits: [{ edits: [{
range: new Range(1, 1, 1, 1), // EDIT happens outside of whole range range: new Range(1, 1, 1, 1), // EDIT happens outside of whole range
@ -252,7 +252,7 @@ suite('InteractiveEditorController', function () {
await ctrl.waitFor(TestController.INIT_SEQUENCE); await ctrl.waitFor(TestController.INIT_SEQUENCE);
const session = interactiveEditorSessionService.getSession(editor, editor.getModel()!.uri); const session = inlineChatSessionService.getSession(editor, editor.getModel()!.uri);
assert.ok(session); assert.ok(session);
assert.deepStrictEqual(session.wholeRange.value, new Range(3, 1, 3, 12)); assert.deepStrictEqual(session.wholeRange.value, new Range(3, 1, 3, 12));
@ -264,9 +264,9 @@ suite('InteractiveEditorController', function () {
}); });
test('Stuck inline chat widget #211', async function () { test('Stuck inline chat widget #211', async function () {
const d = interactiveEditorService.addProvider({ const d = inlineChatService.addProvider({
debugName: 'Unit Test', debugName: 'Unit Test',
prepareInteractiveEditorSession() { prepareInlineChatSession() {
return { return {
id: Math.random(), id: Math.random(),
wholeRange: new Range(3, 1, 3, 3) wholeRange: new Range(3, 1, 3, 3)
@ -278,7 +278,7 @@ suite('InteractiveEditorController', function () {
await timeout(50000); await timeout(50000);
return { return {
type: InteractiveEditorResponseType.EditorEdit, type: InlineChatResponseType.EditorEdit,
id: Math.random(), id: Math.random(),
edits: [{ edits: [{
range: new Range(1, 1, 1, 1), // EDIT happens outside of whole range range: new Range(1, 1, 1, 1), // EDIT happens outside of whole range

View file

@ -17,8 +17,8 @@ import { InputFocusedContextKey } from 'vs/platform/contextkey/common/contextkey
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { Registry } from 'vs/platform/registry/common/platform'; import { Registry } from 'vs/platform/registry/common/platform';
import { InteractiveEditorController } from 'vs/workbench/contrib/inlineChat/browser/inlineChatController'; import { InlineChatController } from 'vs/workbench/contrib/inlineChat/browser/inlineChatController';
import { CTX_INTERACTIVE_EDITOR_FOCUSED, CTX_INTERACTIVE_EDITOR_INNER_CURSOR_LAST } from 'vs/workbench/contrib/inlineChat/common/inlineChat'; import { CTX_INLINE_CHAT_FOCUSED, CTX_INLINE_CHAT_INNER_CURSOR_LAST } from 'vs/workbench/contrib/inlineChat/common/inlineChat';
import { INotebookActionContext, INotebookCellActionContext, NotebookAction, NotebookCellAction, NOTEBOOK_EDITOR_WIDGET_ACTION_WEIGHT, findTargetCellEditor } from 'vs/workbench/contrib/notebook/browser/controller/coreActions'; import { INotebookActionContext, INotebookCellActionContext, NotebookAction, NotebookCellAction, NOTEBOOK_EDITOR_WIDGET_ACTION_WEIGHT, findTargetCellEditor } from 'vs/workbench/contrib/notebook/browser/controller/coreActions';
import { CellEditState } from 'vs/workbench/contrib/notebook/browser/notebookBrowser'; import { CellEditState } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
import { CellKind, NOTEBOOK_EDITOR_CURSOR_BOUNDARY } from 'vs/workbench/contrib/notebook/common/notebookCommon'; import { CellKind, NOTEBOOK_EDITOR_CURSOR_BOUNDARY } from 'vs/workbench/contrib/notebook/common/notebookCommon';
@ -88,8 +88,8 @@ registerAction2(class FocusNextCellAction extends NotebookCellAction {
NOTEBOOK_EDITOR_CURSOR_BOUNDARY.notEqualsTo('top'), NOTEBOOK_EDITOR_CURSOR_BOUNDARY.notEqualsTo('top'),
NOTEBOOK_EDITOR_CURSOR_BOUNDARY.notEqualsTo('none'), NOTEBOOK_EDITOR_CURSOR_BOUNDARY.notEqualsTo('none'),
), ),
CTX_INTERACTIVE_EDITOR_FOCUSED, CTX_INLINE_CHAT_FOCUSED,
CTX_INTERACTIVE_EDITOR_INNER_CURSOR_LAST, CTX_INLINE_CHAT_INNER_CURSOR_LAST,
EditorContextKeys.isEmbeddedDiffEditor.negate() EditorContextKeys.isEmbeddedDiffEditor.negate()
), ),
primary: KeyCode.DownArrow, primary: KeyCode.DownArrow,
@ -104,8 +104,8 @@ registerAction2(class FocusNextCellAction extends NotebookCellAction {
NOTEBOOK_CELL_TYPE.isEqualTo('markup'), NOTEBOOK_CELL_TYPE.isEqualTo('markup'),
NOTEBOOK_CELL_MARKDOWN_EDIT_MODE.isEqualTo(false), NOTEBOOK_CELL_MARKDOWN_EDIT_MODE.isEqualTo(false),
NOTEBOOK_CURSOR_NAVIGATION_MODE), NOTEBOOK_CURSOR_NAVIGATION_MODE),
CTX_INTERACTIVE_EDITOR_FOCUSED, CTX_INLINE_CHAT_FOCUSED,
CTX_INTERACTIVE_EDITOR_INNER_CURSOR_LAST, CTX_INLINE_CHAT_INNER_CURSOR_LAST,
EditorContextKeys.isEmbeddedDiffEditor.negate() EditorContextKeys.isEmbeddedDiffEditor.negate()
), ),
primary: KeyCode.DownArrow, primary: KeyCode.DownArrow,
@ -133,8 +133,8 @@ registerAction2(class FocusNextCellAction extends NotebookCellAction {
const targetCell = (context.cell ?? context.selectedCells?.[0]); const targetCell = (context.cell ?? context.selectedCells?.[0]);
const foundEditor: ICodeEditor | undefined = targetCell ? findTargetCellEditor(context, targetCell) : undefined; const foundEditor: ICodeEditor | undefined = targetCell ? findTargetCellEditor(context, targetCell) : undefined;
if (foundEditor && foundEditor.hasTextFocus() && InteractiveEditorController.get(foundEditor)?.getWidgetPosition()?.lineNumber === focusEditorLine) { if (foundEditor && foundEditor.hasTextFocus() && InlineChatController.get(foundEditor)?.getWidgetPosition()?.lineNumber === focusEditorLine) {
InteractiveEditorController.get(foundEditor)?.focus(); InlineChatController.get(foundEditor)?.focus();
} else { } else {
const newCell = editor.cellAt(idx + 1); const newCell = editor.cellAt(idx + 1);
const newFocusMode = newCell.cellKind === CellKind.Markup && newCell.getEditState() === CellEditState.Preview ? 'container' : 'editor'; const newFocusMode = newCell.cellKind === CellKind.Markup && newCell.getEditState() === CellEditState.Preview ? 'container' : 'editor';
@ -207,8 +207,8 @@ registerAction2(class FocusPreviousCellAction extends NotebookCellAction {
const foundEditor: ICodeEditor | undefined = findTargetCellEditor(context, newCell); const foundEditor: ICodeEditor | undefined = findTargetCellEditor(context, newCell);
if (foundEditor && InteractiveEditorController.get(foundEditor)?.getWidgetPosition()?.lineNumber === focusEditorLine) { if (foundEditor && InlineChatController.get(foundEditor)?.getWidgetPosition()?.lineNumber === focusEditorLine) {
InteractiveEditorController.get(foundEditor)?.focus(); InlineChatController.get(foundEditor)?.focus();
} }
} }
}); });

View file

@ -31,7 +31,7 @@ import { INotebookKernelService } from 'vs/workbench/contrib/notebook/common/not
import { IDialogService, IConfirmationResult } from 'vs/platform/dialogs/common/dialogs'; import { IDialogService, IConfirmationResult } from 'vs/platform/dialogs/common/dialogs';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { InteractiveEditorController } from 'vs/workbench/contrib/inlineChat/browser/inlineChatController'; import { InlineChatController } from 'vs/workbench/contrib/inlineChat/browser/inlineChatController';
const CLEAR_ALL_CELLS_OUTPUTS_COMMAND_ID = 'notebook.clearAllCellsOutputs'; const CLEAR_ALL_CELLS_OUTPUTS_COMMAND_ID = 'notebook.clearAllCellsOutputs';
@ -76,8 +76,8 @@ registerAction2(class EditCellAction extends NotebookCellAction {
await context.notebookEditor.focusNotebookCell(context.cell, 'editor'); await context.notebookEditor.focusNotebookCell(context.cell, 'editor');
const foundEditor: ICodeEditor | undefined = context.cell ? findTargetCellEditor(context, context.cell) : undefined; const foundEditor: ICodeEditor | undefined = context.cell ? findTargetCellEditor(context, context.cell) : undefined;
if (foundEditor && foundEditor.hasTextFocus() && InteractiveEditorController.get(foundEditor)?.getWidgetPosition()?.lineNumber === foundEditor.getPosition()?.lineNumber) { if (foundEditor && foundEditor.hasTextFocus() && InlineChatController.get(foundEditor)?.getWidgetPosition()?.lineNumber === foundEditor.getPosition()?.lineNumber) {
InteractiveEditorController.get(foundEditor)?.focus(); InlineChatController.get(foundEditor)?.focus();
} }
} }
}); });

View file

@ -17,8 +17,8 @@ import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { EditorsOrder } from 'vs/workbench/common/editor'; import { EditorsOrder } from 'vs/workbench/common/editor';
import { IDebugService } from 'vs/workbench/contrib/debug/common/debug'; import { IDebugService } from 'vs/workbench/contrib/debug/common/debug';
import { InteractiveEditorController } from 'vs/workbench/contrib/inlineChat/browser/inlineChatController'; import { InlineChatController } from 'vs/workbench/contrib/inlineChat/browser/inlineChatController';
import { CTX_INTERACTIVE_EDITOR_FOCUSED } from 'vs/workbench/contrib/inlineChat/common/inlineChat'; import { CTX_INLINE_CHAT_FOCUSED } from 'vs/workbench/contrib/inlineChat/common/inlineChat';
import { insertCell } from 'vs/workbench/contrib/notebook/browser/controller/cellOperations'; import { insertCell } from 'vs/workbench/contrib/notebook/browser/controller/cellOperations';
import { CELL_TITLE_CELL_GROUP_ID, CellToolbarOrder, INotebookActionContext, INotebookCellActionContext, INotebookCellToolbarActionContext, INotebookCommandContext, NOTEBOOK_EDITOR_WIDGET_ACTION_WEIGHT, NotebookAction, NotebookCellAction, NotebookMultiCellAction, cellExecutionArgs, executeNotebookCondition, getContextFromActiveEditor, getContextFromUri, parseMultiCellExecutionArgs } from 'vs/workbench/contrib/notebook/browser/controller/coreActions'; import { CELL_TITLE_CELL_GROUP_ID, CellToolbarOrder, INotebookActionContext, INotebookCellActionContext, INotebookCellToolbarActionContext, INotebookCommandContext, NOTEBOOK_EDITOR_WIDGET_ACTION_WEIGHT, NotebookAction, NotebookCellAction, NotebookMultiCellAction, cellExecutionArgs, executeNotebookCondition, getContextFromActiveEditor, getContextFromUri, parseMultiCellExecutionArgs } from 'vs/workbench/contrib/notebook/browser/controller/coreActions';
import { CellEditState, CellFocusMode, EXECUTE_CELL_COMMAND_ID } from 'vs/workbench/contrib/notebook/browser/notebookBrowser'; import { CellEditState, CellFocusMode, EXECUTE_CELL_COMMAND_ID } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
@ -103,7 +103,7 @@ async function runCell(editorGroupsService: IEditorGroupsService, context: INote
return; return;
} }
const controller = InteractiveEditorController.get(foundEditor); const controller = InlineChatController.get(foundEditor);
if (!controller) { if (!controller) {
return; return;
} }
@ -436,7 +436,7 @@ registerAction2(class ExecuteCellSelectBelow extends NotebookCellAction {
keybinding: { keybinding: {
when: ContextKeyExpr.and( when: ContextKeyExpr.and(
NOTEBOOK_CELL_LIST_FOCUSED, NOTEBOOK_CELL_LIST_FOCUSED,
CTX_INTERACTIVE_EDITOR_FOCUSED.negate() CTX_INLINE_CHAT_FOCUSED.negate()
), ),
primary: KeyMod.Shift | KeyCode.Enter, primary: KeyMod.Shift | KeyCode.Enter,
weight: NOTEBOOK_EDITOR_WIDGET_ACTION_WEIGHT weight: NOTEBOOK_EDITOR_WIDGET_ACTION_WEIGHT