mirror of
https://github.com/Microsoft/vscode
synced 2024-08-28 05:19:39 +00:00
Merge pull request #208822 from cpendery/fix/bundle-suggestion-error
fix: bundling error makes terminal suggestions fail
This commit is contained in:
commit
78447f9ef2
|
@ -296,7 +296,8 @@ export class SuggestAddon extends Disposable implements ITerminalAddon, ISuggest
|
||||||
// TODO: What do frozen and auto do?
|
// TODO: What do frozen and auto do?
|
||||||
const xtermBox = this._screen!.getBoundingClientRect();
|
const xtermBox = this._screen!.getBoundingClientRect();
|
||||||
const panelBox = this._panel!.offsetParent!.getBoundingClientRect();
|
const panelBox = this._panel!.offsetParent!.getBoundingClientRect();
|
||||||
suggestWidget.showSuggestions(model, 0, false, false, {
|
suggestWidget.setCompletionModel(model);
|
||||||
|
suggestWidget.showSuggestions(0, false, false, {
|
||||||
left: (xtermBox.left - panelBox.left) + this._terminal.buffer.active.cursorX * dimensions.width,
|
left: (xtermBox.left - panelBox.left) + this._terminal.buffer.active.cursorX * dimensions.width,
|
||||||
top: (xtermBox.top - panelBox.top) + this._terminal.buffer.active.cursorY * dimensions.height,
|
top: (xtermBox.top - panelBox.top) + this._terminal.buffer.active.cursorY * dimensions.height,
|
||||||
height: dimensions.height
|
height: dimensions.height
|
||||||
|
@ -467,7 +468,8 @@ export class SuggestAddon extends Disposable implements ITerminalAddon, ISuggest
|
||||||
// TODO: What do frozen and auto do?
|
// TODO: What do frozen and auto do?
|
||||||
const xtermBox = this._screen!.getBoundingClientRect();
|
const xtermBox = this._screen!.getBoundingClientRect();
|
||||||
const panelBox = this._panel!.offsetParent!.getBoundingClientRect();
|
const panelBox = this._panel!.offsetParent!.getBoundingClientRect();
|
||||||
this._suggestWidget?.showSuggestions((this._suggestWidget as any)._completionModel, 0, false, false, {
|
|
||||||
|
this._suggestWidget?.showSuggestions(0, false, false, {
|
||||||
left: (xtermBox.left - panelBox.left) + (this._terminal.buffer.active.cursorX + handledCursorDelta) * dimensions.width,
|
left: (xtermBox.left - panelBox.left) + (this._terminal.buffer.active.cursorX + handledCursorDelta) * dimensions.width,
|
||||||
top: (xtermBox.top - panelBox.top) + this._terminal.buffer.active.cursorY * dimensions.height,
|
top: (xtermBox.top - panelBox.top) + this._terminal.buffer.active.cursorY * dimensions.height,
|
||||||
height: dimensions.height
|
height: dimensions.height
|
||||||
|
|
|
@ -204,7 +204,11 @@ export class SimpleSuggestWidget implements IDisposable {
|
||||||
|
|
||||||
private _cursorPosition?: { top: number; left: number; height: number };
|
private _cursorPosition?: { top: number; left: number; height: number };
|
||||||
|
|
||||||
showSuggestions(completionModel: SimpleCompletionModel, selectionIndex: number, isFrozen: boolean, isAuto: boolean, cursorPosition: { top: number; left: number; height: number }): void {
|
setCompletionModel(completionModel: SimpleCompletionModel) {
|
||||||
|
this._completionModel = completionModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
showSuggestions(selectionIndex: number, isFrozen: boolean, isAuto: boolean, cursorPosition: { top: number; left: number; height: number }): void {
|
||||||
this._cursorPosition = cursorPosition;
|
this._cursorPosition = cursorPosition;
|
||||||
|
|
||||||
// this._contentWidget.setPosition(this.editor.getPosition());
|
// this._contentWidget.setPosition(this.editor.getPosition());
|
||||||
|
@ -213,16 +217,12 @@ export class SimpleSuggestWidget implements IDisposable {
|
||||||
// this._currentSuggestionDetails?.cancel();
|
// this._currentSuggestionDetails?.cancel();
|
||||||
// this._currentSuggestionDetails = undefined;
|
// this._currentSuggestionDetails = undefined;
|
||||||
|
|
||||||
if (this._completionModel !== completionModel) {
|
|
||||||
this._completionModel = completionModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isFrozen && this._state !== State.Empty && this._state !== State.Hidden) {
|
if (isFrozen && this._state !== State.Empty && this._state !== State.Hidden) {
|
||||||
this._setState(State.Frozen);
|
this._setState(State.Frozen);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const visibleCount = this._completionModel.items.length;
|
const visibleCount = this._completionModel?.items.length ?? 0;
|
||||||
const isEmpty = visibleCount === 0;
|
const isEmpty = visibleCount === 0;
|
||||||
// this._ctxSuggestWidgetMultipleSuggestions.set(visibleCount > 1);
|
// this._ctxSuggestWidgetMultipleSuggestions.set(visibleCount > 1);
|
||||||
|
|
||||||
|
@ -241,7 +241,7 @@ export class SimpleSuggestWidget implements IDisposable {
|
||||||
// this._onDidFocus.pause();
|
// this._onDidFocus.pause();
|
||||||
// this._onDidSelect.pause();
|
// this._onDidSelect.pause();
|
||||||
try {
|
try {
|
||||||
this._list.splice(0, this._list.length, this._completionModel.items);
|
this._list.splice(0, this._list.length, this._completionModel?.items ?? []);
|
||||||
this._setState(isFrozen ? State.Frozen : State.Open);
|
this._setState(isFrozen ? State.Frozen : State.Open);
|
||||||
this._list.reveal(selectionIndex, 0);
|
this._list.reveal(selectionIndex, 0);
|
||||||
this._list.setFocus([selectionIndex]);
|
this._list.setFocus([selectionIndex]);
|
||||||
|
|
Loading…
Reference in a new issue