Merge from vscode cfc1ab4c5f816765b91fb7ead3c3427a7c8581a3

This commit is contained in:
ADS Merger
2020-03-11 04:19:23 +00:00
parent 16fab722d5
commit 4c3e48773d
880 changed files with 20441 additions and 11232 deletions

View File

@@ -25,7 +25,7 @@ import { Context as SuggestContext, CompletionItem, suggestWidgetStatusbarMenu }
import { CompletionModel } from './completionModel';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { attachListStyler } from 'vs/platform/theme/common/styler';
import { IThemeService, ITheme, registerThemingParticipant } from 'vs/platform/theme/common/themeService';
import { IThemeService, IColorTheme, registerThemingParticipant } from 'vs/platform/theme/common/themeService';
import { registerColor, editorWidgetBackground, listFocusBackground, activeContrastBorder, listHighlightForeground, editorForeground, editorWidgetBorder, focusBorder, textLinkForeground, textCodeBlockBackground } from 'vs/platform/theme/common/colorRegistry';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import { MarkdownRenderer } from 'vs/editor/contrib/markdown/markdownRenderer';
@@ -144,11 +144,10 @@ class ItemRenderer implements IListRenderer<CompletionItem, ISuggestionTemplateD
const text = append(container, $('.contents'));
const main = append(text, $('.main'));
data.iconContainer = append(main, $('.icon-label.codicon'));
data.left = append(main, $('span.left'));
data.right = append(main, $('span.right'));
data.iconContainer = append(data.left, $('.icon-label.codicon'));
data.iconLabel = new IconLabel(data.left, { supportHighlights: true, supportCodicons: true });
data.disposables.add(data.iconLabel);
@@ -211,7 +210,7 @@ class ItemRenderer implements IListRenderer<CompletionItem, ISuggestionTemplateD
data.iconContainer.className = 'icon hide';
data.colorspan.style.backgroundColor = color[0];
} else if (suggestion.kind === CompletionItemKind.File && this._themeService.getIconTheme().hasFileIcons) {
} else if (suggestion.kind === CompletionItemKind.File && this._themeService.getFileIconTheme().hasFileIcons) {
// special logic for 'file' completion items
data.icon.className = 'icon hide';
data.iconContainer.className = 'icon hide';
@@ -219,7 +218,7 @@ class ItemRenderer implements IListRenderer<CompletionItem, ISuggestionTemplateD
const detailClasses = getIconClasses(this._modelService, this._modeService, URI.from({ scheme: 'fake', path: suggestion.detail }), FileKind.FILE);
labelOptions.extraClasses = labelClasses.length > detailClasses.length ? labelClasses : detailClasses;
} else if (suggestion.kind === CompletionItemKind.Folder && this._themeService.getIconTheme().hasFolderIcons) {
} else if (suggestion.kind === CompletionItemKind.Folder && this._themeService.getFileIconTheme().hasFolderIcons) {
// special logic for 'folder' completion items
data.icon.className = 'icon hide';
data.iconContainer.className = 'icon hide';
@@ -474,7 +473,8 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<Compl
readonly allowEditorOverflow = true;
readonly suppressMouseDown = false;
private state: State | null = null;
private state: State = State.Hidden;
private isAddedAsContentWidget: boolean = false;
private isAuto: boolean = false;
private loadingTimeout: IDisposable = Disposable.None;
private currentSuggestionDetails: CancelablePromise<void> | null = null;
@@ -627,12 +627,12 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<Compl
listInactiveFocusBackground: editorSuggestWidgetSelectedBackground,
listInactiveFocusOutline: activeContrastBorder
}));
this.toDispose.add(themeService.onThemeChange(t => this.onThemeChange(t)));
this.toDispose.add(themeService.onDidColorThemeChange(t => this.onThemeChange(t)));
this.toDispose.add(editor.onDidLayoutChange(() => this.onEditorLayoutChange()));
this.toDispose.add(this.list.onMouseDown(e => this.onListMouseDownOrTap(e)));
this.toDispose.add(this.list.onTap(e => this.onListMouseDownOrTap(e)));
this.toDispose.add(this.list.onSelectionChange(e => this.onListSelection(e)));
this.toDispose.add(this.list.onFocusChange(e => this.onListFocus(e)));
this.toDispose.add(this.list.onDidChangeSelection(e => this.onListSelection(e)));
this.toDispose.add(this.list.onDidChangeFocus(e => this.onListFocus(e)));
this.toDispose.add(this.editor.onDidChangeCursorSelection(() => this.onCursorSelectionChanged()));
this.toDispose.add(this.editor.onDidChangeConfiguration(e => {
if (e.hasChanged(EditorOption.suggest)) {
@@ -645,10 +645,7 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<Compl
this.ctxSuggestWidgetDetailsVisible = SuggestContext.DetailsVisible.bindTo(contextKeyService);
this.ctxSuggestWidgetMultipleSuggestions = SuggestContext.MultipleSuggestions.bindTo(contextKeyService);
this.editor.addContentWidget(this);
this.setState(State.Hidden);
this.onThemeChange(themeService.getTheme());
this.onThemeChange(themeService.getColorTheme());
this.toDispose.add(addStandardDisposableListener(this.details.element, 'keydown', e => {
this._onDetailsKeydown.fire(e);
@@ -715,7 +712,7 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<Compl
this.editor.focus();
}
private onThemeChange(theme: ITheme) {
private onThemeChange(theme: IColorTheme) {
const backgroundColor = theme.getColor(editorSuggestWidgetBackground);
if (backgroundColor) {
this.listElement.style.backgroundColor = backgroundColor.toString();
@@ -811,6 +808,11 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<Compl
return;
}
if (!this.isAddedAsContentWidget && state !== State.Hidden) {
this.isAddedAsContentWidget = true;
this.editor.addContentWidget(this);
}
const stateChanged = this.state !== state;
this.state = state;
@@ -1291,6 +1293,7 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<Compl
this.toDispose.dispose();
this.loadingTimeout.dispose();
this.showTimeout.dispose();
this.editor.removeContentWidget(this);
}
}