mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-23 10:08:49 +01:00
more inline chat controller alignment (#239785)
* remove `InlineChatController#onWillStartSession` * more inline chat controller alignment * more inline chat controller alignment * fix compile errors
This commit is contained in:
@@ -8,7 +8,7 @@ import { ICodeEditor, MouseTargetType } from '../../../../editor/browser/editorB
|
||||
import { IEditorContribution } from '../../../../editor/common/editorCommon.js';
|
||||
import { localize, localize2 } from '../../../../nls.js';
|
||||
import { ContextKeyExpr, IContextKey, IContextKeyService, RawContextKey } from '../../../../platform/contextkey/common/contextkey.js';
|
||||
import { InlineChatController, State } from './inlineChatController.js';
|
||||
import { InlineChatController } from './inlineChatController.js';
|
||||
import { ACTION_START, CTX_INLINE_CHAT_HAS_AGENT, CTX_INLINE_CHAT_VISIBLE, InlineChatConfigKeys } from '../common/inlineChat.js';
|
||||
import { EditorAction2, ServicesAccessor } from '../../../../editor/browser/editorExtensions.js';
|
||||
import { EditOperation } from '../../../../editor/common/core/editOperation.js';
|
||||
@@ -83,22 +83,14 @@ export class InlineChatExpandLineAction extends EditorAction2 {
|
||||
return null;
|
||||
});
|
||||
|
||||
let lastState: State | undefined;
|
||||
const d = ctrl.onDidEnterState(e => lastState = e);
|
||||
// trigger chat
|
||||
const accepted = await ctrl.run({
|
||||
autoSend: true,
|
||||
message: lineContent.trim(),
|
||||
position: new Position(lineNumber, startColumn)
|
||||
});
|
||||
|
||||
try {
|
||||
// trigger chat
|
||||
await ctrl.run({
|
||||
autoSend: true,
|
||||
message: lineContent.trim(),
|
||||
position: new Position(lineNumber, startColumn)
|
||||
});
|
||||
|
||||
} finally {
|
||||
d.dispose();
|
||||
}
|
||||
|
||||
if (lastState === State.CANCEL) {
|
||||
if (!accepted) {
|
||||
model.pushEditOperations(null, undoEdits, () => null);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user