mirror of
https://github.com/microsoft/vscode.git
synced 2026-07-12 22:08:04 -05:00
tweak inline chat hint (#234821)
* make editor readonly and disable squiggle while inline chat shows reply https://github.com/microsoft/vscode/issues/226160 * tweak inline chat hint only show on intented empty lines, hide when command run * fix tests (only disable squiggle, not readonlyness)
This commit is contained in:
@@ -17,6 +17,7 @@ import { StopWatch } from '../../../../base/common/stopwatch.js';
|
||||
import { assertType } from '../../../../base/common/types.js';
|
||||
import { generateUuid } from '../../../../base/common/uuid.js';
|
||||
import { ICodeEditor, isCodeEditor } from '../../../../editor/browser/editorBrowser.js';
|
||||
import { EditorOption } from '../../../../editor/common/config/editorOptions.js';
|
||||
import { IPosition, Position } from '../../../../editor/common/core/position.js';
|
||||
import { IRange, Range } from '../../../../editor/common/core/range.js';
|
||||
import { ISelection, Selection, SelectionDirection } from '../../../../editor/common/core/selection.js';
|
||||
@@ -591,8 +592,19 @@ export class InlineChatController implements IEditorContribution {
|
||||
const progressiveEditsClock = StopWatch.create();
|
||||
const progressiveEditsQueue = new Queue();
|
||||
|
||||
let next: State.WAIT_FOR_INPUT | State.SHOW_REQUEST | State.CANCEL | State.PAUSE | State.ACCEPT = State.WAIT_FOR_INPUT;
|
||||
// disable typing and squiggles while streaming a reply
|
||||
const origDeco = this._editor.getOption(EditorOption.renderValidationDecorations);
|
||||
this._editor.updateOptions({
|
||||
renderValidationDecorations: 'off'
|
||||
});
|
||||
store.add(toDisposable(() => {
|
||||
this._editor.updateOptions({
|
||||
renderValidationDecorations: origDeco
|
||||
});
|
||||
}));
|
||||
|
||||
|
||||
let next: State.WAIT_FOR_INPUT | State.SHOW_REQUEST | State.CANCEL | State.PAUSE | State.ACCEPT = State.WAIT_FOR_INPUT;
|
||||
store.add(Event.once(this._messages.event)(message => {
|
||||
this._log('state=_makeRequest) message received', message);
|
||||
this._chatService.cancelCurrentRequestForSession(chatModel.sessionId);
|
||||
|
||||
@@ -184,6 +184,12 @@ export class InlineChatHintsController extends Disposable implements IEditorCont
|
||||
|
||||
const ghostCtrl = InlineCompletionsController.get(editor);
|
||||
|
||||
this._store.add(commandService.onWillExecuteCommand(e => {
|
||||
if (e.commandId === _inlineChatActionId || e.commandId === ACTION_START) {
|
||||
this.hide();
|
||||
}
|
||||
}));
|
||||
|
||||
this._store.add(this._editor.onMouseDown(e => {
|
||||
if (e.target.type !== MouseTargetType.CONTENT_TEXT) {
|
||||
return;
|
||||
@@ -227,12 +233,13 @@ export class InlineChatHintsController extends Disposable implements IEditorCont
|
||||
|
||||
const visible = this._visibilityObs.read(r);// || this._ctxMenuVisibleObs.read(r);
|
||||
const isEol = model.getLineMaxColumn(position.lineNumber) === position.column;
|
||||
const isWhitespace = model.getLineLastNonWhitespaceColumn(position.lineNumber) === 0 && model.getValueLength() > 0;
|
||||
const isWhitespace = model.getLineLastNonWhitespaceColumn(position.lineNumber) === 0 && model.getValueLength() > 0 && position.column > 1;
|
||||
|
||||
const shouldShow = (isWhitespace && _configurationService.getValue(InlineChatConfigKeys.LineEmptyHint))
|
||||
|| (visible && isEol && _configurationService.getValue(InlineChatConfigKeys.LineSuffixHint));
|
||||
if (isWhitespace && !_configurationService.getValue(InlineChatConfigKeys.LineEmptyHint)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if (!shouldShow) {
|
||||
if (!visible || !isEol || !_configurationService.getValue(InlineChatConfigKeys.LineSuffixHint)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ import { ITextModelService } from '../../../../../editor/common/services/resolve
|
||||
import { TextModelResolverService } from '../../../../services/textmodelResolver/common/textModelResolverService.js';
|
||||
import { ChatInputBoxContentProvider } from '../../../chat/browser/chatEdinputInputContentProvider.js';
|
||||
|
||||
suite('InteractiveChatController', function () {
|
||||
suite('InlineChatController', function () {
|
||||
|
||||
const agentData = {
|
||||
extensionId: nullExtensionDescription.identifier,
|
||||
|
||||
@@ -211,7 +211,7 @@ async function loadTests(opts) {
|
||||
]);
|
||||
|
||||
const _allowedSuitesWithOutput = new Set([
|
||||
'InteractiveChatController'
|
||||
'InlineChatController'
|
||||
]);
|
||||
|
||||
let _testsWithUnexpectedOutput = false;
|
||||
|
||||
Reference in New Issue
Block a user