joh/faithful horse (#177065)

* better showing of errors

* 💄
This commit is contained in:
Johannes Rieken
2023-03-14 11:11:19 +01:00
committed by GitHub
parent bbe8e872dc
commit 6c8f7acfea
2 changed files with 26 additions and 2 deletions
@@ -112,6 +112,13 @@
top: 0;
}
/* message */
.monaco-editor .interactive-editor .message {
padding: 6px 8px;
color: var(--vscode-errorForeground);
}
/* decoration styles */
@@ -46,6 +46,7 @@ import { ThemeIcon } from 'vs/base/common/themables';
import { LRUCache } from 'vs/base/common/map';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IBulkEditService } from 'vs/editor/browser/services/bulkEditService';
import { toErrorMessage } from 'vs/base/common/errorMessage';
interface IHistoryEntry {
@@ -74,7 +75,8 @@ class InteractiveEditorWidget {
]),
h('div.toolbar@rhsToolbar'),
]),
h('div.progress@progress')
h('div.progress@progress'),
h('div.message@message'),
]
);
@@ -231,7 +233,7 @@ class InteractiveEditorWidget {
}
getHeight(): number {
return this._inputEditor.getContentHeight() + getTotalHeight(this._elements.history);
return this._inputEditor.getContentHeight() + getTotalHeight(this._elements.message) + getTotalHeight(this._elements.history);
}
updateProgress(show: boolean) {
@@ -374,9 +376,20 @@ class InteractiveEditorWidget {
reset(this._elements.history);
}
showMessage(value: string) {
this._elements.message.innerText = value;
this._onDidChangeHeight.fire();
}
clearMessage() {
reset(this._elements.message);
this._onDidChangeHeight.fire();
}
reset() {
this._ctxInputEmpty.reset();
this.clearHistory();
this.clearMessage();
}
focus() {
@@ -738,6 +751,8 @@ export class InteractiveEditorController implements IEditorContribution {
this._historyOffset = -1;
const input = await this._zone.getInput(wholeRange.getEndPosition(), placeholder, value, this._ctsRequest.token);
this._zone.widget.clearMessage();
if (!input || !input.value) {
continue;
}
@@ -763,6 +778,7 @@ export class InteractiveEditorController implements IEditorContribution {
if (!isCancellationError(e)) {
this._logService.error('[IE] ERROR during request', provider.debugName);
this._logService.error(e);
this._zone.widget.showMessage(toErrorMessage(e));
}
} finally {
this._ctxHasActiveRequest.set(false);
@@ -781,6 +797,7 @@ export class InteractiveEditorController implements IEditorContribution {
if (!reply) {
this._logService.trace('[IE] NO reply or edits', provider.debugName);
value = input.value;
this._zone.widget.showMessage(localize('empty', "No results, tweak your input and try again."));
historyEntry.remove();
continue;
}