Merge from vscode e3c4990c67c40213af168300d1cfeb71d680f877 (#16569)

This commit is contained in:
Cory Rivera
2021-08-25 16:28:29 -07:00
committed by GitHub
parent ab1112bfb3
commit cb7b7da0a4
1752 changed files with 59525 additions and 33878 deletions

View File

@@ -24,7 +24,7 @@ import { URI } from 'vs/base/common/uri';
import { Schemas } from 'vs/base/common/network';
import * as nls from 'vs/nls';
import { IModelService } from 'vs/editor/common/services/modelService';
import { IDisposable } from 'vs/base/common/lifecycle';
import { DisposableStore, IDisposable } from 'vs/base/common/lifecycle';
import { Command } from 'vs/editor/browser/editorExtensions';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { KeyMod, KeyCode } from 'vs/base/common/keyCodes';
@@ -39,7 +39,6 @@ import { IStorageService } from 'vs/platform/storage/common/storage';
import { IView, SplitView, Sizing } from 'vs/base/browser/ui/splitview/splitview';
import * as DOM from 'vs/base/browser/dom';
import { EditorPane } from 'vs/workbench/browser/parts/editor/editorPane';
import { EditorOptions } from 'vs/workbench/common/editor';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IWorkbenchThemeService, VS_DARK_THEME, VS_HC_THEME } from 'vs/workbench/services/themes/common/workbenchThemeService';
import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
@@ -53,6 +52,8 @@ import { ITextResourcePropertiesService } from 'vs/editor/common/services/textRe
import { UntitledTextEditorInput } from 'vs/workbench/services/untitled/common/untitledTextEditorInput';
import { attachTabbedPanelStyler } from 'sql/workbench/common/styler';
import { UntitledTextEditorModel } from 'vs/workbench/services/untitled/common/untitledTextEditorModel';
import { IEditorOptions } from 'vs/platform/editor/common/editor';
import { IEditorGroup, IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
class BasicView implements IView {
public get element(): HTMLElement {
@@ -155,6 +156,7 @@ export class ProfilerEditor extends EditorPane {
private _savedTableViewStates = new Map<ProfilerInput, ProfilerTableViewState>();
private readonly _disposables = new DisposableStore();
constructor(
@ITelemetryService telemetryService: ITelemetryService,
@IWorkbenchThemeService themeService: IWorkbenchThemeService,
@@ -166,23 +168,34 @@ export class ProfilerEditor extends EditorPane {
@IEditorService editorService: IEditorService,
@IStorageService storageService: IStorageService,
@IClipboardService private _clipboardService: IClipboardService,
@ITextResourcePropertiesService private readonly textResourcePropertiesService: ITextResourcePropertiesService
@ITextResourcePropertiesService private readonly textResourcePropertiesService: ITextResourcePropertiesService,
@IEditorGroupsService editorGroupsService: IEditorGroupsService
) {
super(ProfilerEditor.ID, telemetryService, themeService, storageService);
this._profilerEditorContextKey = CONTEXT_PROFILER_EDITOR.bindTo(this._contextKeyService);
if (editorService) {
editorService.overrideOpenEditor({
open: (editor, options, group) => {
if (this.isVisible() && (editor !== this.input || group !== this.group)) {
this.saveEditorViewState();
}
return {};
}
});
if (editorGroupsService) {
// Add all the initial groups to be listened to
editorGroupsService.whenReady.then(() => editorGroupsService.groups.forEach(group => {
this.registerGroupListener(group);
}));
// Additional groups added should also be listened to
this._register(editorGroupsService.onDidAddGroup((group) => this.registerGroupListener(group)));
this._register(this._disposables);
}
}
private registerGroupListener(group: IEditorGroup): void {
const listener = group.onWillOpenEditor(e => {
if (this.isVisible() && (e.editor !== this.input || group !== this.group)) {
this.saveEditorViewState();
}
});
this._disposables.add(listener);
}
protected createEditor(parent: HTMLElement): void {
this._container = document.createElement('div');
this._container.className = 'carbon-profiler';
@@ -307,7 +320,7 @@ export class ProfilerEditor extends EditorPane {
profilerTableContainer.classList.add(VS_HC_THEME);
}
this.themeService.onDidColorThemeChange(e => {
DOM.removeClasses(profilerTableContainer, VS_DARK_THEME, VS_HC_THEME);
profilerTableContainer.classList.remove(VS_DARK_THEME, VS_HC_THEME);
if (e.type === ColorScheme.DARK) {
profilerTableContainer.classList.add(VS_DARK_THEME);
} else if (e.type === ColorScheme.HIGH_CONTRAST) {
@@ -447,7 +460,7 @@ export class ProfilerEditor extends EditorPane {
return this._input as ProfilerInput;
}
public override setInput(input: ProfilerInput, options?: EditorOptions): Promise<void> {
public override setInput(input: ProfilerInput, options?: IEditorOptions): Promise<void> {
let savedViewState = this._savedTableViewStates.get(input);
this._profilerEditorContextKey.set(true);

View File

@@ -127,9 +127,9 @@ export class FindWidget extends Widget implements IOverlayWidget, IVerticalSashL
if (FIND_WIDGET_INITIAL_WIDTH + 28 - MAX_MATCHES_COUNT_WIDTH >= editorWidth + 50) {
collapsedFindWidget = true;
}
dom.toggleClass(this._domNode, 'collapsed-find-widget', collapsedFindWidget);
dom.toggleClass(this._domNode, 'narrow-find-widget', narrowFindWidget);
dom.toggleClass(this._domNode, 'reduced-find-widget', reducedFindWidget);
this._domNode.classList.toggle('collapsed-find-widget', collapsedFindWidget);
this._domNode.classList.toggle('narrow-find-widget', narrowFindWidget);
this._domNode.classList.toggle('reduced-find-widget', reducedFindWidget);
if (!narrowFindWidget && !collapsedFindWidget) {
// the minimal left offset of findwidget is 15px.
@@ -204,7 +204,7 @@ export class FindWidget extends Widget implements IOverlayWidget, IVerticalSashL
}
if (e.searchString || e.matchesCount || e.matchesPosition) {
let showRedOutline = (this._state.searchString.length > 0 && this._state.matchesCount === 0);
dom.toggleClass(this._domNode, 'no-results', showRedOutline);
this._domNode.classList.toggle('no-results', showRedOutline);
this._updateMatchesCount();
}
@@ -552,7 +552,7 @@ class SimpleButton extends Widget {
}
public setEnabled(enabled: boolean): void {
dom.toggleClass(this._domNode, 'disabled', !enabled);
this._domNode.classList.toggle('disabled', !enabled);
this._domNode.setAttribute('aria-disabled', String(!enabled));
this._domNode.tabIndex = enabled ? 0 : -1;
}
@@ -562,6 +562,6 @@ class SimpleButton extends Widget {
}
public toggleClass(className: string, shouldHaveIt: boolean): void {
dom.toggleClass(this._domNode, className, shouldHaveIt);
this._domNode.classList.toggle(className, shouldHaveIt);
}
}

View File

@@ -6,7 +6,7 @@
import { IEditorOptions } from 'vs/editor/common/config/editorOptions';
import * as nls from 'vs/nls';
import * as DOM from 'vs/base/browser/dom';
import { ResourceEditorModel } from 'vs/workbench/common/editor/resourceEditorModel';
import { TextResourceEditorModel } from 'vs/workbench/common/editor/textResourceEditorModel';
import * as editorCommon from 'vs/editor/common/editorCommon';
import { BaseTextEditor } from 'vs/workbench/browser/parts/editor/textEditor';
@@ -15,12 +15,13 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { IStorageService } from 'vs/platform/storage/common/storage';
import { ITextResourceConfigurationService } from 'vs/editor/common/services/textResourceConfigurationService';
import { EditorOptions, IEditorOpenContext } from 'vs/workbench/common/editor';
import { IEditorOpenContext } from 'vs/workbench/common/editor';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { CancellationToken } from 'vs/base/common/cancellation';
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
import { UntitledTextEditorInput } from 'vs/workbench/services/untitled/common/untitledTextEditorInput';
import { CodeEditorWidget } from 'vs/editor/browser/widget/codeEditorWidget';
import { ITextEditorOptions } from 'vs/platform/editor/common/editor';
class ProfilerResourceCodeEditor extends CodeEditorWidget {
@@ -75,9 +76,9 @@ export class ProfilerResourceEditor extends BaseTextEditor {
return options;
}
override async setInput(input: UntitledTextEditorInput, options: EditorOptions, context: IEditorOpenContext): Promise<void> {
override async setInput(input: UntitledTextEditorInput, options: ITextEditorOptions, context: IEditorOpenContext): Promise<void> {
await super.setInput(input, options, context, CancellationToken.None);
const editorModel = await this.input.resolve() as ResourceEditorModel;
const editorModel = await this.input.resolve() as TextResourceEditorModel;
await editorModel.resolve();
this.getControl().setModel(editorModel.textEditorModel);
}

View File

@@ -288,7 +288,7 @@ export class ProfilerTableEditor extends EditorPane implements IProfilerControll
: localize('ProfilerTableEditor.eventCount', "Events: {0}", this._input.data.getLength());
this._disposeStatusbarItem();
this._statusbarItem = this._statusbarService.addEntry({ text: message, ariaLabel: message }, 'status.eventCount', localize('status.eventCount', "Event Count"), StatusbarAlignment.RIGHT);
this._statusbarItem = this._statusbarService.addEntry({ name: localize('status.eventCount', "Event Count"), text: message, ariaLabel: message }, 'status.eventCount', StatusbarAlignment.RIGHT);
}
}