提交 86d9b79a 编写于 作者: J Johannes Rieken

fix #43148

上级 4185a7f0
......@@ -10,7 +10,7 @@ import * as strings from 'vs/base/common/strings';
import { Event, Emitter } from 'vs/base/common/event';
import { onUnexpectedError } from 'vs/base/common/errors';
import { IDisposable, dispose, toDisposable } from 'vs/base/common/lifecycle';
import { addClass, append, $, hide, removeClass, show, toggleClass, getDomNodePagePosition, hasClass } from 'vs/base/browser/dom';
import { addClass, append, $, hide, removeClass, show, toggleClass, getDomNodePagePosition, hasClass, addDisposableListener } from 'vs/base/browser/dom';
import { IListVirtualDelegate, IListEvent, IListRenderer, IListMouseEvent } from 'vs/base/browser/ui/list/list';
import { List } from 'vs/base/browser/ui/list/listWidget';
import { DomScrollableElement } from 'vs/base/browser/ui/scrollbar/scrollableElement';
......@@ -399,6 +399,7 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<Compl
// Editor.IContentWidget.allowEditorOverflow
readonly allowEditorOverflow = true;
readonly suppressMouseDown = true;
private state: State | null;
private isAuto: boolean;
......@@ -420,14 +421,13 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<Compl
private readonly editorBlurTimeout = new TimeoutTimer();
private readonly showTimeout = new TimeoutTimer();
private toDispose: IDisposable[];
private readonly toDispose: IDisposable[] = [];
private onDidSelectEmitter = new Emitter<ISelectedSuggestion>();
private onDidFocusEmitter = new Emitter<ISelectedSuggestion>();
private onDidHideEmitter = new Emitter<this>();
private onDidShowEmitter = new Emitter<this>();
readonly onDidSelect: Event<ISelectedSuggestion> = this.onDidSelectEmitter.event;
readonly onDidFocus: Event<ISelectedSuggestion> = this.onDidFocusEmitter.event;
readonly onDidHide: Event<this> = this.onDidHideEmitter.event;
......@@ -464,6 +464,11 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<Compl
this.storageService = storageService;
this.element = $('.editor-widget.suggest-widget');
this.toDispose.push(addDisposableListener(this.element, 'click', e => {
if (e.target === this.element) {
this.hideWidget();
}
}));
this.messageElement = append(this.element, $('.message'));
this.listElement = append(this.element, $('.tree'));
......@@ -480,7 +485,7 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<Compl
mouseSupport: false
});
this.toDispose = [
this.toDispose.push(
attachListStyler(this.list, themeService, {
listInactiveFocusBackground: editorSuggestWidgetSelectedBackground,
listInactiveFocusOutline: activeContrastBorder
......@@ -492,7 +497,7 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<Compl
this.list.onFocusChange(e => this.onListFocus(e)),
this.editor.onDidChangeCursorSelection(() => this.onCursorSelectionChanged()),
this.editor.onDidChangeConfiguration(e => e.contribInfo && applyIconStyle())
];
);
this.suggestWidgetVisible = SuggestContext.Visible.bindTo(contextKeyService);
this.suggestWidgetMultipleSuggestions = SuggestContext.MultipleSuggestions.bindTo(contextKeyService);
......@@ -1152,7 +1157,7 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<Compl
this.details = null!; // StrictNullOverride: nulling out ok in dispose
this.list.dispose();
this.list = null!; // StrictNullOverride: nulling out ok in dispose
this.toDispose = dispose(this.toDispose);
dispose(this.toDispose);
if (this.loadingTimeout) {
clearTimeout(this.loadingTimeout);
this.loadingTimeout = null;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册