Merge VS Code 1.31.1 (#4283)

This commit is contained in:
Matt Irvine
2019-03-15 13:09:45 -07:00
committed by GitHub
parent 7d31575149
commit 86bac90001
1716 changed files with 53308 additions and 48375 deletions

View File

@@ -12,7 +12,7 @@ import { IEditorGroup, IEditorGroupsService } from 'vs/workbench/services/group/
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import { LRUCache } from 'vs/base/common/map';
import { URI } from 'vs/base/common/uri';
import { once, Event } from 'vs/base/common/event';
import { Event } from 'vs/base/common/event';
import { isEmptyObject } from 'vs/base/common/types';
import { DEFAULT_EDITOR_MIN_DIMENSIONS, DEFAULT_EDITOR_MAX_DIMENSIONS } from 'vs/workbench/browser/parts/editor/editor';
@@ -38,12 +38,12 @@ export abstract class BaseEditor extends Panel implements IEditor {
readonly minimumHeight = DEFAULT_EDITOR_MIN_DIMENSIONS.height;
readonly maximumHeight = DEFAULT_EDITOR_MAX_DIMENSIONS.height;
readonly onDidSizeConstraintsChange: Event<{ width: number; height: number; }> = Event.None;
readonly onDidSizeConstraintsChange: Event<{ width: number; height: number; } | undefined> = Event.None;
protected _input: EditorInput;
protected _options: EditorOptions;
protected _input: EditorInput | null;
protected _options: EditorOptions | null;
private _group: IEditorGroup;
private _group?: IEditorGroup;
constructor(
id: string,
@@ -54,15 +54,15 @@ export abstract class BaseEditor extends Panel implements IEditor {
super(id, telemetryService, themeService, storageService);
}
get input(): EditorInput {
get input(): EditorInput | null {
return this._input;
}
get options(): EditorOptions {
get options(): EditorOptions | null {
return this._options;
}
get group(): IEditorGroup {
get group(): IEditorGroup | undefined {
return this._group;
}
@@ -77,7 +77,7 @@ export abstract class BaseEditor extends Panel implements IEditor {
* The provided cancellation token should be used to test if the operation
* was cancelled.
*/
setInput(input: EditorInput, options: EditorOptions, token: CancellationToken): Thenable<void> {
setInput(input: EditorInput, options: EditorOptions | null, token: CancellationToken): Promise<void> {
this._input = input;
this._options = options;
@@ -100,7 +100,7 @@ export abstract class BaseEditor extends Panel implements IEditor {
* Sets the given options to the editor. Clients should apply the options
* to the current input.
*/
setOptions(options: EditorOptions): void {
setOptions(options: EditorOptions | null): void {
this._options = options;
}
@@ -118,6 +118,7 @@ export abstract class BaseEditor extends Panel implements IEditor {
setVisible(visible: boolean, group?: IEditorGroup): void {
super.setVisible(visible);
// Propagate to Editor
this.setEditorVisible(visible, group);
}
@@ -129,7 +130,7 @@ export abstract class BaseEditor extends Panel implements IEditor {
* @param visible the state of visibility of this editor
* @param group the editor group this editor is in.
*/
protected setEditorVisible(visible: boolean, group: IEditorGroup): void {
protected setEditorVisible(visible: boolean, group: IEditorGroup | undefined): void {
this._group = group;
}
@@ -205,18 +206,18 @@ export class EditorMemento<T> implements IEditorMemento<T> {
// Automatically clear when editor input gets disposed if any
if (resourceOrEditor instanceof EditorInput) {
once(resourceOrEditor.onDispose)(() => {
Event.once(resourceOrEditor.onDispose)(() => {
this.clearEditorState(resource);
});
}
}
loadEditorState(group: IEditorGroup, resource: URI): T;
loadEditorState(group: IEditorGroup, editor: EditorInput): T;
loadEditorState(group: IEditorGroup, resourceOrEditor: URI | EditorInput): T {
loadEditorState(group: IEditorGroup, resource: URI): T | undefined;
loadEditorState(group: IEditorGroup, editor: EditorInput): T | undefined;
loadEditorState(group: IEditorGroup, resourceOrEditor: URI | EditorInput): T | undefined {
const resource = this.doGetResource(resourceOrEditor);
if (!resource || !group) {
return void 0; // we are not in a good state to load any state for a resource
return undefined; // we are not in a good state to load any state for a resource
}
const cache = this.doLoad();
@@ -226,7 +227,7 @@ export class EditorMemento<T> implements IEditorMemento<T> {
return mementoForResource[group.id];
}
return void 0;
return undefined;
}
clearEditorState(resource: URI, group?: IEditorGroup): void;
@@ -247,7 +248,7 @@ export class EditorMemento<T> implements IEditorMemento<T> {
}
}
private doGetResource(resourceOrEditor: URI | EditorInput): URI {
private doGetResource(resourceOrEditor: URI | EditorInput): URI | null {
if (resourceOrEditor instanceof EditorInput) {
return resourceOrEditor.getResource();
}

View File

@@ -28,7 +28,7 @@ export class BinaryResourceDiffEditor extends SideBySideEditor {
super(telemetryService, instantiationService, themeService, storageService);
}
getMetadata(): string {
getMetadata(): string | null {
const master = this.masterEditor;
const details = this.detailsEditor;

View File

@@ -21,7 +21,7 @@ import { dispose } from 'vs/base/common/lifecycle';
import { IStorageService } from 'vs/platform/storage/common/storage';
export interface IOpenCallbacks {
openInternal: (input: EditorInput, options: EditorOptions) => Thenable<void>;
openInternal: (input: EditorInput, options: EditorOptions) => Promise<void>;
openExternal: (uri: URI) => void;
}
@@ -37,7 +37,7 @@ export abstract class BaseBinaryResourceEditor extends BaseEditor {
get onDidOpenInPlace(): Event<void> { return this._onDidOpenInPlace.event; }
private callbacks: IOpenCallbacks;
private metadata: string;
private metadata: string | null;
private binaryContainer: HTMLElement;
private scrollbar: DomScrollableElement;
private resourceViewerContext: ResourceViewerContext;
@@ -55,7 +55,7 @@ export abstract class BaseBinaryResourceEditor extends BaseEditor {
this.callbacks = callbacks;
}
getTitle(): string {
getTitle() {
return this.input ? this.input.getName() : nls.localize('binaryEditor', "Binary Viewer");
}
@@ -72,13 +72,13 @@ export abstract class BaseBinaryResourceEditor extends BaseEditor {
parent.appendChild(this.scrollbar.getDomNode());
}
setInput(input: EditorInput, options: EditorOptions, token: CancellationToken): Thenable<void> {
setInput(input: EditorInput, options: EditorOptions, token: CancellationToken): Promise<void> {
return super.setInput(input, options, token).then(() => {
return input.resolve().then(model => {
// Check for cancellation
if (token.isCancellationRequested) {
return void 0;
return undefined;
}
// Assert Model instance
@@ -97,7 +97,7 @@ export abstract class BaseBinaryResourceEditor extends BaseEditor {
meta => this.handleMetadataChanged(meta)
);
return void 0;
return undefined;
});
});
}
@@ -110,13 +110,13 @@ export abstract class BaseBinaryResourceEditor extends BaseEditor {
});
}
private handleMetadataChanged(meta: string): void {
private handleMetadataChanged(meta: string | null): void {
this.metadata = meta;
this._onMetadataChanged.fire();
}
getMetadata(): string {
getMetadata() {
return this.metadata;
}

View File

@@ -23,7 +23,7 @@ export interface IBreadcrumbsService {
register(group: GroupIdentifier, widget: BreadcrumbsWidget): IDisposable;
getWidget(group: GroupIdentifier): BreadcrumbsWidget;
getWidget(group: GroupIdentifier): BreadcrumbsWidget | undefined;
}
@@ -43,12 +43,12 @@ export class BreadcrumbsService implements IBreadcrumbsService {
};
}
getWidget(group: number): BreadcrumbsWidget {
getWidget(group: number): BreadcrumbsWidget | undefined {
return this._map.get(group);
}
}
registerSingleton(IBreadcrumbsService, BreadcrumbsService);
registerSingleton(IBreadcrumbsService, BreadcrumbsService, true);
//#region config
@@ -59,7 +59,7 @@ export abstract class BreadcrumbsConfig<T> {
onDidChange: Event<void>;
abstract getValue(overrides?: IConfigurationOverrides): T;
abstract updateValue(value: T, overrides?: IConfigurationOverrides): Thenable<void>;
abstract updateValue(value: T, overrides?: IConfigurationOverrides): Promise<void>;
abstract dispose(): void;
private constructor() {
@@ -90,10 +90,18 @@ export abstract class BreadcrumbsConfig<T> {
readonly name = name;
readonly onDidChange = onDidChange.event;
getValue(overrides?: IConfigurationOverrides): T {
return service.getValue(name, overrides);
if (overrides) {
return service.getValue(name, overrides);
} else {
return service.getValue(name);
}
}
updateValue(newValue: T, overrides?: IConfigurationOverrides): Thenable<void> {
return service.updateValue(name, newValue, overrides);
updateValue(newValue: T, overrides?: IConfigurationOverrides): Promise<void> {
if (overrides) {
return service.updateValue(name, newValue, overrides);
} else {
return service.updateValue(name, newValue);
}
}
dispose(): void {
listener.dispose();
@@ -112,7 +120,7 @@ Registry.as<IConfigurationRegistry>(Extensions.Configuration).registerConfigurat
type: 'object',
properties: {
'breadcrumbs.enabled': {
description: localize('enabled', "Enable/disable navigation breadcrumbs"),
description: localize('enabled', "Enable/disable navigation breadcrumbs."),
type: 'boolean',
default: false
},

View File

@@ -35,7 +35,7 @@ import { ColorIdentifier, ColorFunction } from 'vs/platform/theme/common/colorRe
import { attachBreadcrumbsStyler } from 'vs/platform/theme/common/styler';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { FileLabel } from 'vs/workbench/browser/labels';
import { ResourceLabel } from 'vs/workbench/browser/labels';
import { BreadcrumbsConfig, IBreadcrumbsService } from 'vs/workbench/browser/parts/editor/breadcrumbs';
import { BreadcrumbElement, EditorBreadcrumbsModel, FileElement } from 'vs/workbench/browser/parts/editor/breadcrumbsModel';
import { BreadcrumbsPicker, createBreadcrumbsPicker } from 'vs/workbench/browser/parts/editor/breadcrumbsPicker';
@@ -78,8 +78,8 @@ class Item extends BreadcrumbsItem {
render(container: HTMLElement): void {
if (this.element instanceof FileElement) {
// file/folder
let label = this._instantiationService.createInstance(FileLabel, container, {});
label.setFile(this.element.uri, {
let label = this._instantiationService.createInstance(ResourceLabel, container, {});
label.element.setFile(this.element.uri, {
hidePath: true,
hideIcon: this.element.kind === FileKind.FOLDER || !this.options.showFileIcons,
fileKind: this.element.kind,
@@ -98,7 +98,7 @@ class Item extends BreadcrumbsItem {
} else if (this.element instanceof OutlineGroup) {
// provider
let label = new IconLabel(container);
label.setValue(this.element.provider.displayName);
label.setLabel(this.element.provider.displayName);
this._disposables.push(label);
} else if (this.element instanceof OutlineElement) {
@@ -111,7 +111,7 @@ class Item extends BreadcrumbsItem {
}
let label = new IconLabel(container);
let title = this.element.symbol.name.replace(/\r|\n|\r\n/g, '\u23CE');
label.setValue(title);
label.setLabel(title);
this._disposables.push(label);
}
}
@@ -356,7 +356,7 @@ export class BreadcrumbsControl {
},
getAnchor: () => {
let maxInnerWidth = window.innerWidth - 8 /*a little less the full widget*/;
let maxHeight = Math.min(window.innerHeight * .7, 300);
let maxHeight = Math.min(window.innerHeight * 0.7, 300);
let pickerWidth = Math.min(maxInnerWidth, Math.max(240, maxInnerWidth / 4.17));
let pickerArrowSize = 8;
@@ -379,7 +379,7 @@ export class BreadcrumbsControl {
pickerArrowOffset = maxPickerArrowOffset;
}
} else {
pickerArrowOffset = (data.left + (data.width * .3)) - x;
pickerArrowOffset = (data.left + (data.width * 0.3)) - x;
}
picker.setInput(element, maxHeight, pickerWidth, pickerArrowSize, Math.max(0, pickerArrowOffset));
return { x, y };
@@ -453,15 +453,17 @@ MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
category: localize('cmd.category', "View")
}
});
MenuRegistry.appendMenuItem(MenuId.MenubarViewMenu, {
group: '5_editor',
order: 99,
command: {
id: 'breadcrumbs.toggle',
title: localize('miToggleBreadcrumbs', "Toggle &&Breadcrumbs"),
toggled: ContextKeyExpr.equals('config.breadcrumbs.enabled', true)
}
});
// {{SQL CARBON EDIT}} - Disable unused menu item
// MenuRegistry.appendMenuItem(MenuId.MenubarViewMenu, {
// group: '5_editor',
// order: 99,
// command: {
// id: 'breadcrumbs.toggle',
// title: localize('miToggleBreadcrumbs', "Toggle &&Breadcrumbs"),
// toggled: ContextKeyExpr.equals('config.breadcrumbs.enabled', true)
// }
// });
// {{SQL CARBON EDIT}} - End
CommandsRegistry.registerCommand('breadcrumbs.toggle', accessor => {
let config = accessor.get(IConfigurationService);
let value = BreadcrumbsConfig.IsEnabled.bindTo(config).getValue();

View File

@@ -8,7 +8,7 @@ import { TimeoutTimer } from 'vs/base/common/async';
import { CancellationTokenSource } from 'vs/base/common/cancellation';
import { size } from 'vs/base/common/collections';
import { onUnexpectedError } from 'vs/base/common/errors';
import { debounceEvent, Emitter, Event } from 'vs/base/common/event';
import { Emitter, Event } from 'vs/base/common/event';
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
import { isEqual, dirname } from 'vs/base/common/resources';
import { URI } from 'vs/base/common/uri';
@@ -31,7 +31,7 @@ export class FileElement {
export type BreadcrumbElement = FileElement | OutlineModel | OutlineGroup | OutlineElement;
type FileInfo = { path: FileElement[], folder: IWorkspaceFolder };
type FileInfo = { path: FileElement[], folder?: IWorkspaceFolder };
export class EditorBreadcrumbsModel {
@@ -41,7 +41,7 @@ export class EditorBreadcrumbsModel {
private readonly _cfgFilePath: BreadcrumbsConfig<'on' | 'off' | 'last'>;
private readonly _cfgSymbolPath: BreadcrumbsConfig<'on' | 'off' | 'last'>;
private _outlineElements: (OutlineModel | OutlineGroup | OutlineElement)[] = [];
private _outlineElements: Array<OutlineModel | OutlineGroup | OutlineElement> = [];
private _outlineDisposables: IDisposable[] = [];
private _onDidUpdate = new Emitter<this>();
@@ -105,16 +105,21 @@ export class EditorBreadcrumbsModel {
}
let info: FileInfo = {
folder: workspaceService.getWorkspaceFolder(uri),
folder: workspaceService.getWorkspaceFolder(uri) || undefined,
path: []
};
while (uri.path !== '/') {
if (info.folder && isEqual(info.folder.uri, uri)) {
let uriPrefix: URI | null = uri;
while (uriPrefix && uriPrefix.path !== '/') {
if (info.folder && isEqual(info.folder.uri, uriPrefix)) {
break;
}
info.path.unshift(new FileElement(uriPrefix, info.path.length === 0 ? FileKind.FILE : FileKind.FOLDER));
let prevPathLength = uriPrefix.path.length;
uriPrefix = dirname(uriPrefix);
if (!uriPrefix || uriPrefix.path.length === prevPathLength) {
break;
}
info.path.unshift(new FileElement(uri, info.path.length === 0 ? FileKind.FILE : FileKind.FOLDER));
uri = dirname(uri);
}
if (info.folder && workspaceService.getWorkbenchState() === WorkbenchState.WORKSPACE) {
@@ -131,7 +136,7 @@ export class EditorBreadcrumbsModel {
this._disposables.push(DocumentSymbolProviderRegistry.onDidChange(_ => this._updateOutline()));
this._disposables.push(this._editor.onDidChangeModel(_ => this._updateOutline()));
this._disposables.push(this._editor.onDidChangeModelLanguage(_ => this._updateOutline()));
this._disposables.push(debounceEvent(this._editor.onDidChangeModelContent, _ => _, 350)(_ => this._updateOutline(true)));
this._disposables.push(Event.debounce(this._editor.onDidChangeModelContent, _ => _, 350)(_ => this._updateOutline(true)));
this._updateOutline();
// stop when editor dies
@@ -145,7 +150,9 @@ export class EditorBreadcrumbsModel {
this._updateOutlineElements([]);
}
const buffer = this._editor.getModel();
const editor = this._editor!;
const buffer = editor.getModel();
if (!buffer || !DocumentSymbolProviderRegistry.has(buffer) || !isEqual(buffer.uri, this._uri)) {
return;
}
@@ -171,11 +178,11 @@ export class EditorBreadcrumbsModel {
// copy the model
model = model.adopt();
this._updateOutlineElements(this._getOutlineElements(model, this._editor.getPosition()));
this._outlineDisposables.push(this._editor.onDidChangeCursorPosition(_ => {
this._updateOutlineElements(this._getOutlineElements(model, editor.getPosition()));
this._outlineDisposables.push(editor.onDidChangeCursorPosition(_ => {
timeout.cancelAndSet(() => {
if (!buffer.isDisposed() && versionIdThen === buffer.getVersionId() && this._editor.getModel()) {
this._updateOutlineElements(this._getOutlineElements(model, this._editor.getPosition()));
if (!buffer.isDisposed() && versionIdThen === buffer.getVersionId() && editor.getModel()) {
this._updateOutlineElements(this._getOutlineElements(model, editor.getPosition()));
}
}, 150);
}));
@@ -186,22 +193,22 @@ export class EditorBreadcrumbsModel {
});
}
private _getOutlineElements(model: OutlineModel, position: IPosition): (OutlineModel | OutlineGroup | OutlineElement)[] {
if (!model) {
private _getOutlineElements(model: OutlineModel, position: IPosition | null): Array<OutlineModel | OutlineGroup | OutlineElement> {
if (!model || !position) {
return [];
}
let item: OutlineGroup | OutlineElement = model.getItemEnclosingPosition(position);
let item: OutlineGroup | OutlineElement | undefined = model.getItemEnclosingPosition(position);
if (!item) {
return [model];
}
let chain: (OutlineGroup | OutlineElement)[] = [];
let chain: Array<OutlineGroup | OutlineElement> = [];
while (item) {
chain.push(item);
let parent = item.parent;
if (parent instanceof OutlineModel) {
break;
}
if (parent instanceof OutlineGroup && size(parent.parent.children) === 1) {
if (parent instanceof OutlineGroup && parent.parent && size(parent.parent.children) === 1) {
break;
}
item = parent;
@@ -209,7 +216,7 @@ export class EditorBreadcrumbsModel {
return chain.reverse();
}
private _updateOutlineElements(elements: (OutlineModel | OutlineGroup | OutlineElement)[]): void {
private _updateOutlineElements(elements: Array<OutlineModel | OutlineGroup | OutlineElement>): void {
if (!equals(elements, this._outlineElements, EditorBreadcrumbsModel._outlineElementEquals)) {
this._outlineElements = elements;
this._onDidUpdate.fire(this);

View File

@@ -14,7 +14,6 @@ import { dispose, IDisposable } from 'vs/base/common/lifecycle';
import { join } from 'vs/base/common/paths';
import { basename, dirname, isEqual } from 'vs/base/common/resources';
import { URI } from 'vs/base/common/uri';
import { TPromise } from 'vs/base/common/winjs.base';
import { IDataSource, IFilter, IRenderer, ISorter, ITree } from 'vs/base/parts/tree/browser/tree';
import 'vs/css!./media/breadcrumbscontrol';
import { OutlineElement, OutlineModel, TreeElement } from 'vs/editor/contrib/documentSymbols/outlineModel';
@@ -26,7 +25,7 @@ import { IConstructorSignature1, IInstantiationService } from 'vs/platform/insta
import { HighlightingWorkbenchTree, IHighlighter, IHighlightingTreeConfiguration, IHighlightingTreeOptions } from 'vs/platform/list/browser/listService';
import { breadcrumbsPickerBackground, widgetShadow } from 'vs/platform/theme/common/colorRegistry';
import { IWorkspace, IWorkspaceContextService, IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
import { FileLabel } from 'vs/workbench/browser/labels';
import { ResourceLabels, IResourceLabel, DEFAULT_LABELS_CONTAINER } from 'vs/workbench/browser/labels';
import { BreadcrumbsConfig } from 'vs/workbench/browser/parts/editor/breadcrumbs';
import { BreadcrumbElement, FileElement } from 'vs/workbench/browser/parts/editor/breadcrumbsModel';
import { IFileIconTheme, IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
@@ -160,7 +159,7 @@ export abstract class BreadcrumbsPicker {
// use proper selection, reveal
let selection = this._getInitialSelection(this._tree, input);
if (selection) {
return this._tree.reveal(selection, .5).then(() => {
return this._tree.reveal(selection, 0.5).then(() => {
this._tree.setSelection([selection], this._tree);
this._tree.setFocus(selection);
this._tree.domFocus();
@@ -228,7 +227,7 @@ export class FileDataSource implements IDataSource {
return URI.isUri(element) || IWorkspace.isIWorkspace(element) || IWorkspaceFolder.isIWorkspaceFolder(element) || element.isDirectory;
}
getChildren(tree: ITree, element: IWorkspace | IWorkspaceFolder | IFileStat | URI): TPromise<IWorkspaceFolder[] | IFileStat[]> {
getChildren(tree: ITree, element: IWorkspace | IWorkspaceFolder | IFileStat | URI): Promise<IWorkspaceFolder[] | IFileStat[]> {
if (IWorkspace.isIWorkspace(element)) {
return Promise.resolve(element.folders).then(folders => {
for (let child of folders) {
@@ -253,7 +252,7 @@ export class FileDataSource implements IDataSource {
});
}
getParent(tree: ITree, element: IWorkspace | URI | IWorkspaceFolder | IFileStat): TPromise<IWorkspaceFolder | IFileStat> {
getParent(tree: ITree, element: IWorkspace | URI | IWorkspaceFolder | IFileStat): Promise<IWorkspaceFolder | IFileStat> {
return Promise.resolve(this._parents.get(element));
}
}
@@ -330,7 +329,7 @@ export class FileHighlighter implements IHighlighter {
export class FileRenderer implements IRenderer {
constructor(
@IInstantiationService private readonly _instantiationService: IInstantiationService,
private readonly _labels: ResourceLabels,
@IConfigurationService private readonly _configService: IConfigurationService,
) { }
@@ -343,10 +342,10 @@ export class FileRenderer implements IRenderer {
}
renderTemplate(tree: ITree, templateId: string, container: HTMLElement) {
return this._instantiationService.createInstance(FileLabel, container, { supportHighlights: true });
return this._labels.create(container, { supportHighlights: true });
}
renderElement(tree: ITree, element: IFileStat | IWorkspaceFolder, templateId: string, templateData: FileLabel): void {
renderElement(tree: ITree, element: IFileStat | IWorkspaceFolder, templateId: string, templateData: IResourceLabel): void {
let fileDecorations = this._configService.getValue<{ colors: boolean, badges: boolean }>('explorer.decorations');
let resource: URI;
let fileKind: FileKind;
@@ -366,7 +365,7 @@ export class FileRenderer implements IRenderer {
});
}
disposeTemplate(tree: ITree, templateId: string, templateData: FileLabel): void {
disposeTemplate(tree: ITree, templateId: string, templateData: IResourceLabel): void {
templateData.dispose();
}
}
@@ -428,7 +427,9 @@ export class BreadcrumbsFilePicker extends BreadcrumbsPicker {
this._disposables.push(filter);
config.dataSource = this._instantiationService.createInstance(FileDataSource);
config.renderer = this._instantiationService.createInstance(FileRenderer);
const labels = this._instantiationService.createInstance(ResourceLabels, DEFAULT_LABELS_CONTAINER /* TODO@Jo visibility propagation */);
this._disposables.push(labels);
config.renderer = this._instantiationService.createInstance(FileRenderer, labels);
config.sorter = new FileSorter();
config.highlighter = new FileHighlighter();
config.filter = filter;

View File

@@ -50,6 +50,7 @@ import { AllEditorsPicker, ActiveEditorGroupPicker } from 'vs/workbench/browser/
import { Schemas } from 'vs/base/common/network';
import { registerEditorContribution } from 'vs/editor/browser/editorExtensions';
import { OpenWorkspaceButtonContribution } from 'vs/workbench/browser/parts/editor/editorWidgets';
import { ZoomStatusbarItem } from 'vs/workbench/browser/parts/editor/resourceViewer';
// Register String Editor
Registry.as<IEditorRegistry>(EditorExtensions.Editors).registerEditor(
@@ -110,7 +111,7 @@ interface ISerializedUntitledEditorInput {
class UntitledEditorInputFactory implements IEditorInputFactory {
constructor(
@ITextFileService private textFileService: ITextFileService
@ITextFileService private readonly textFileService: ITextFileService
) { }
serialize(editorInput: EditorInput): string {
@@ -144,7 +145,7 @@ class UntitledEditorInputFactory implements IEditorInputFactory {
return instantiationService.invokeFunction<UntitledEditorInput>(accessor => {
const deserialized: ISerializedUntitledEditorInput = JSON.parse(serializedEditorInput);
const resource = !!deserialized.resourceJSON ? URI.revive(deserialized.resourceJSON) : URI.parse(deserialized.resource);
const filePath = resource.scheme === Schemas.file ? resource.fsPath : void 0;
const filePath = resource.scheme === Schemas.file ? resource.fsPath : undefined;
const language = deserialized.modeId;
const encoding = deserialized.encoding;
@@ -226,6 +227,9 @@ registerEditorContribution(OpenWorkspaceButtonContribution);
const statusBar = Registry.as<IStatusbarRegistry>(StatusExtensions.Statusbar);
statusBar.registerStatusbarItem(new StatusbarItemDescriptor(EditorStatus, StatusbarAlignment.RIGHT, 100 /* towards the left of the right hand side */));
// Register Zoom Status
statusBar.registerStatusbarItem(new StatusbarItemDescriptor(ZoomStatusbarItem, StatusbarAlignment.RIGHT, 101 /* to the left of editor status (100) */));
// Register Status Actions
const registry = Registry.as<IWorkbenchActionRegistry>(ActionExtensions.WorkbenchActions);
registry.registerWorkbenchAction(new SyncActionDescriptor(ChangeModeAction, ChangeModeAction.ID, ChangeModeAction.LABEL, { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyCode.KEY_M) }), 'Change Language Mode');
@@ -235,7 +239,7 @@ registry.registerWorkbenchAction(new SyncActionDescriptor(ChangeEncodingAction,
export class QuickOpenActionContributor extends ActionBarContributor {
private openToSideActionInstance: OpenToSideFromQuickOpenAction;
constructor(@IInstantiationService private instantiationService: IInstantiationService) {
constructor(@IInstantiationService private readonly instantiationService: IInstantiationService) {
super();
}
@@ -745,7 +749,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarLayoutMenu, {
// Forward/Back
MenuRegistry.appendMenuItem(MenuId.MenubarGoMenu, {
group: '1_fwd_back',
group: '1_history_nav',
command: {
id: 'workbench.action.navigateBack',
title: nls.localize({ key: 'miBack', comment: ['&& denotes a mnemonic'] }, "&&Back"),
@@ -755,7 +759,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarGoMenu, {
});
MenuRegistry.appendMenuItem(MenuId.MenubarGoMenu, {
group: '1_fwd_back',
group: '1_history_nav',
command: {
id: 'workbench.action.navigateForward',
title: nls.localize({ key: 'miForward', comment: ['&& denotes a mnemonic'] }, "&&Forward"),
@@ -764,6 +768,16 @@ MenuRegistry.appendMenuItem(MenuId.MenubarGoMenu, {
order: 2
});
MenuRegistry.appendMenuItem(MenuId.MenubarGoMenu, {
group: '1_history_nav',
command: {
id: 'workbench.action.navigateToLastEditLocation',
title: nls.localize({ key: 'miLastEditLocation', comment: ['&& denotes a mnemonic'] }, "&&Last Edit Location"),
precondition: ContextKeyExpr.has('canNavigateToLastEditLocation')
},
order: 3
});
// Switch Editor
MenuRegistry.appendMenuItem(MenuId.MenubarSwitchEditorMenu, {
group: '1_any',
@@ -802,7 +816,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarSwitchEditorMenu, {
});
MenuRegistry.appendMenuItem(MenuId.MenubarGoMenu, {
group: '2_switch',
group: '2_editor_nav',
title: nls.localize({ key: 'miSwitchEditor', comment: ['&& denotes a mnemonic'] }, "Switch &&Editor"),
submenu: MenuId.MenubarSwitchEditorMenu,
order: 1
@@ -909,7 +923,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarSwitchGroupMenu, {
});
MenuRegistry.appendMenuItem(MenuId.MenubarGoMenu, {
group: '2_switch',
group: '2_editor_nav',
title: nls.localize({ key: 'miSwitchGroup', comment: ['&& denotes a mnemonic'] }, "Switch &&Group"),
submenu: MenuId.MenubarSwitchGroupMenu,
order: 2

View File

@@ -3,7 +3,7 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { GroupIdentifier, IWorkbenchEditorConfiguration, IWorkbenchEditorPartConfiguration, EditorOptions, TextEditorOptions, IEditorInput, IEditorIdentifier, IEditorCloseEvent } from 'vs/workbench/common/editor';
import { GroupIdentifier, IWorkbenchEditorConfiguration, IWorkbenchEditorPartConfiguration, EditorOptions, TextEditorOptions, IEditorInput, IEditorIdentifier, IEditorCloseEvent, IEditor } from 'vs/workbench/common/editor';
import { EditorGroup } from 'vs/workbench/common/editor/editorGroup';
import { IEditorGroup, GroupDirection, IAddGroupOptions, IMergeGroupOptions, GroupsOrder, IEditorGroupsService } from 'vs/workbench/services/group/common/editorGroupsService';
import { IDisposable } from 'vs/base/common/lifecycle';
@@ -30,6 +30,7 @@ export const DEFAULT_EDITOR_PART_OPTIONS: IEditorPartOptions = {
highlightModifiedTabs: false,
tabCloseButton: 'right',
tabSizing: 'fit',
focusRecentEditorAfterClose: true,
showIcons: true,
enablePreview: true,
openPositioning: 'right',
@@ -74,9 +75,9 @@ export interface IEditorOpeningEvent extends IEditorIdentifier {
* that will be executed instead. By returning another editor promise
* it is possible to override the opening with another editor. It is ok
* to return a promise that resolves to NULL to prevent the opening
* altogether.
* alltogether.
*/
prevent(callback: () => Thenable<any>): void;
prevent(callback: () => Promise<IEditor>): void;
}
export interface IEditorGroupsAccessor {
@@ -102,7 +103,7 @@ export interface IEditorGroupsAccessor {
export interface IEditorGroupView extends IDisposable, ISerializableView, IEditorGroup {
readonly group: EditorGroup;
readonly whenRestored: Thenable<void>;
readonly whenRestored: Promise<void>;
readonly disposed: boolean;
readonly onDidFocus: Event<void>;
@@ -119,7 +120,7 @@ export interface IEditorGroupView extends IDisposable, ISerializableView, IEdito
}
export function getActiveTextEditorOptions(group: IEditorGroup, expectedActiveEditor?: IEditorInput, presetOptions?: EditorOptions): EditorOptions {
const activeGroupCodeEditor = group.activeControl ? getCodeEditor(group.activeControl.getControl()) : void 0;
const activeGroupCodeEditor = group.activeControl ? getCodeEditor(group.activeControl.getControl()) : undefined;
if (activeGroupCodeEditor) {
if (!expectedActiveEditor || expectedActiveEditor.matches(group.activeEditor)) {
return TextEditorOptions.fromEditor(activeGroupCodeEditor, presetOptions);
@@ -155,5 +156,5 @@ export interface EditorGroupsServiceImpl extends IEditorGroupsService {
/**
* A promise that resolves when groups have been restored.
*/
readonly whenRestored: Thenable<void>;
readonly whenRestored: Promise<void>;
}

View File

@@ -35,7 +35,7 @@ export class ExecuteCommandAction extends Action {
super(id, label);
}
run(): Thenable<any> {
run(): Promise<any> {
return this.commandService.executeCommand(this.commandId, this.commandArgs);
}
}
@@ -182,7 +182,7 @@ export class JoinTwoGroupsAction extends Action {
constructor(
id: string,
label: string,
@IEditorGroupsService private editorGroupService: IEditorGroupsService
@IEditorGroupsService private readonly editorGroupService: IEditorGroupsService
) {
super(id, label);
}
@@ -196,8 +196,8 @@ export class JoinTwoGroupsAction extends Action {
}
const targetGroupDirections = [GroupDirection.RIGHT, GroupDirection.DOWN, GroupDirection.LEFT, GroupDirection.UP];
for (let i = 0; i < targetGroupDirections.length; i++) {
const targetGroup = this.editorGroupService.findGroup({ direction: targetGroupDirections[i] }, sourceGroup);
for (const targetGroupDirection of targetGroupDirections) {
const targetGroup = this.editorGroupService.findGroup({ direction: targetGroupDirection }, sourceGroup);
if (targetGroup && sourceGroup !== targetGroup) {
this.editorGroupService.mergeGroup(sourceGroup, targetGroup);
@@ -217,7 +217,7 @@ export class JoinAllGroupsAction extends Action {
constructor(
id: string,
label: string,
@IEditorGroupsService private editorGroupService: IEditorGroupsService
@IEditorGroupsService private readonly editorGroupService: IEditorGroupsService
) {
super(id, label);
}
@@ -237,12 +237,12 @@ export class NavigateBetweenGroupsAction extends Action {
constructor(
id: string,
label: string,
@IEditorGroupsService private editorGroupService: IEditorGroupsService
@IEditorGroupsService private readonly editorGroupService: IEditorGroupsService
) {
super(id, label);
}
run(): Thenable<any> {
run(): Promise<any> {
const nextGroup = this.editorGroupService.findGroup({ location: GroupLocation.NEXT }, this.editorGroupService.activeGroup, true);
nextGroup.focus();
@@ -258,12 +258,12 @@ export class FocusActiveGroupAction extends Action {
constructor(
id: string,
label: string,
@IEditorGroupsService private editorGroupService: IEditorGroupsService
@IEditorGroupsService private readonly editorGroupService: IEditorGroupsService
) {
super(id, label);
}
run(): Thenable<any> {
run(): Promise<any> {
this.editorGroupService.activeGroup.focus();
return Promise.resolve(true);
@@ -276,12 +276,12 @@ export abstract class BaseFocusGroupAction extends Action {
id: string,
label: string,
private scope: IFindGroupScope,
@IEditorGroupsService private editorGroupService: IEditorGroupsService
@IEditorGroupsService private readonly editorGroupService: IEditorGroupsService
) {
super(id, label);
}
run(): Thenable<any> {
run(): Promise<any> {
const group = this.editorGroupService.findGroup(this.scope, this.editorGroupService.activeGroup, true);
if (group) {
group.focus();
@@ -409,8 +409,8 @@ export class OpenToSideFromQuickOpenAction extends Action {
static readonly OPEN_TO_SIDE_LABEL = nls.localize('openToSide', "Open to the Side");
constructor(
@IEditorService private editorService: IEditorService,
@IConfigurationService private configurationService: IConfigurationService
@IEditorService private readonly editorService: IEditorService,
@IConfigurationService private readonly configurationService: IConfigurationService
) {
super(OpenToSideFromQuickOpenAction.OPEN_TO_SIDE_ID, OpenToSideFromQuickOpenAction.OPEN_TO_SIDE_LABEL);
@@ -423,7 +423,7 @@ export class OpenToSideFromQuickOpenAction extends Action {
this.class = (preferredDirection === GroupDirection.RIGHT) ? 'quick-open-sidebyside-vertical' : 'quick-open-sidebyside-horizontal';
}
run(context: any): Thenable<any> {
run(context: any): Promise<any> {
const entry = toEditorQuickOpenEntry(context);
if (entry) {
const input = entry.getInput();
@@ -467,13 +467,13 @@ export class CloseEditorAction extends Action {
constructor(
id: string,
label: string,
@ICommandService private commandService: ICommandService
@ICommandService private readonly commandService: ICommandService
) {
super(id, label, 'close-editor-action');
}
run(context?: IEditorCommandsContext): Promise<any> {
return this.commandService.executeCommand(CLOSE_EDITOR_COMMAND_ID, void 0, context);
return this.commandService.executeCommand(CLOSE_EDITOR_COMMAND_ID, undefined, context);
}
}
@@ -485,12 +485,12 @@ export class CloseOneEditorAction extends Action {
constructor(
id: string,
label: string,
@IEditorGroupsService private editorGroupService: IEditorGroupsService
@IEditorGroupsService private readonly editorGroupService: IEditorGroupsService
) {
super(id, label, 'close-editor-action');
}
run(context?: IEditorCommandsContext): Thenable<any> {
run(context?: IEditorCommandsContext): Promise<any> {
let group: IEditorGroup;
let editorIndex: number;
if (context) {
@@ -530,12 +530,12 @@ export class RevertAndCloseEditorAction extends Action {
constructor(
id: string,
label: string,
@IEditorService private editorService: IEditorService
@IEditorService private readonly editorService: IEditorService
) {
super(id, label);
}
run(): Thenable<any> {
run(): Promise<any> {
const activeControl = this.editorService.activeControl;
if (activeControl) {
const editor = activeControl.input;
@@ -563,13 +563,13 @@ export class CloseLeftEditorsInGroupAction extends Action {
constructor(
id: string,
label: string,
@IEditorService private editorService: IEditorService,
@IEditorGroupsService private editorGroupService: IEditorGroupsService
@IEditorService private readonly editorService: IEditorService,
@IEditorGroupsService private readonly editorGroupService: IEditorGroupsService
) {
super(id, label);
}
run(context?: IEditorIdentifier): Thenable<any> {
run(context?: IEditorIdentifier): Promise<any> {
const { group, editor } = getTarget(this.editorService, this.editorGroupService, context);
if (group && editor) {
return group.closeEditors({ direction: CloseDirection.LEFT, except: editor });
@@ -614,7 +614,7 @@ export abstract class BaseCloseAllAction extends Action {
return groupsToClose;
}
run(): Thenable<any> {
run(): Promise<any> {
// Just close all if there are no or one dirty editor
if (this.textFileService.getDirty().length < 2) {
@@ -624,10 +624,10 @@ export abstract class BaseCloseAllAction extends Action {
// Otherwise ask for combined confirmation
return this.textFileService.confirmSave().then(confirm => {
if (confirm === ConfirmResult.CANCEL) {
return void 0;
return undefined;
}
let saveOrRevertPromise: Thenable<boolean>;
let saveOrRevertPromise: Promise<boolean>;
if (confirm === ConfirmResult.DONT_SAVE) {
saveOrRevertPromise = this.textFileService.revertAll(null, { soft: true }).then(() => true);
} else {
@@ -639,12 +639,12 @@ export abstract class BaseCloseAllAction extends Action {
return this.doCloseAll();
}
return void 0;
return undefined;
});
});
}
protected abstract doCloseAll(): Thenable<any>;
protected abstract doCloseAll(): Promise<any>;
}
export class CloseAllEditorsAction extends BaseCloseAllAction {
@@ -677,7 +677,7 @@ export class CloseAllEditorGroupsAction extends BaseCloseAllAction {
@ITextFileService textFileService: ITextFileService,
@IEditorGroupsService editorGroupService: IEditorGroupsService
) {
super(id, label, void 0, textFileService, editorGroupService);
super(id, label, undefined, textFileService, editorGroupService);
}
protected doCloseAll(): Promise<any> {
@@ -695,12 +695,12 @@ export class CloseEditorsInOtherGroupsAction extends Action {
constructor(
id: string,
label: string,
@IEditorGroupsService private editorGroupService: IEditorGroupsService,
@IEditorGroupsService private readonly editorGroupService: IEditorGroupsService,
) {
super(id, label);
}
run(context?: IEditorIdentifier): Thenable<any> {
run(context?: IEditorIdentifier): Promise<any> {
const groupToSkip = context ? this.editorGroupService.getGroup(context.groupId) : this.editorGroupService.activeGroup;
return Promise.all(this.editorGroupService.getGroups(GroupsOrder.MOST_RECENTLY_ACTIVE).map(g => {
if (g.id === groupToSkip.id) {
@@ -720,13 +720,13 @@ export class CloseEditorInAllGroupsAction extends Action {
constructor(
id: string,
label: string,
@IEditorGroupsService private editorGroupService: IEditorGroupsService,
@IEditorService private editorService: IEditorService
@IEditorGroupsService private readonly editorGroupService: IEditorGroupsService,
@IEditorService private readonly editorService: IEditorService
) {
super(id, label);
}
run(): Thenable<any> {
run(): Promise<any> {
const activeEditor = this.editorService.activeEditor;
if (activeEditor) {
return Promise.all(this.editorGroupService.getGroups(GroupsOrder.MOST_RECENTLY_ACTIVE).map(g => g.closeEditor(activeEditor)));
@@ -780,14 +780,14 @@ export class BaseMoveGroupAction extends Action {
break;
}
for (let i = 0; i < targetNeighbours.length; i++) {
const targetNeighbour = this.editorGroupService.findGroup({ direction: targetNeighbours[i] }, sourceGroup);
if (targetNeighbour) {
return targetNeighbour;
for (const targetNeighbour of targetNeighbours) {
const targetNeighbourGroup = this.editorGroupService.findGroup({ direction: targetNeighbour }, sourceGroup);
if (targetNeighbourGroup) {
return targetNeighbourGroup;
}
}
return void 0;
return undefined;
}
}
@@ -852,11 +852,11 @@ export class MinimizeOtherGroupsAction extends Action {
static readonly ID = 'workbench.action.minimizeOtherEditors';
static readonly LABEL = nls.localize('minimizeOtherEditorGroups', "Maximize Editor Group");
constructor(id: string, label: string, @IEditorGroupsService private editorGroupService: IEditorGroupsService) {
constructor(id: string, label: string, @IEditorGroupsService private readonly editorGroupService: IEditorGroupsService) {
super(id, label);
}
run(): Thenable<any> {
run(): Promise<any> {
this.editorGroupService.arrangeGroups(GroupsArrangement.MINIMIZE_OTHERS);
return Promise.resolve(false);
@@ -868,11 +868,11 @@ export class ResetGroupSizesAction extends Action {
static readonly ID = 'workbench.action.evenEditorWidths';
static readonly LABEL = nls.localize('evenEditorGroups', "Reset Editor Group Sizes");
constructor(id: string, label: string, @IEditorGroupsService private editorGroupService: IEditorGroupsService) {
constructor(id: string, label: string, @IEditorGroupsService private readonly editorGroupService: IEditorGroupsService) {
super(id, label);
}
run(): Thenable<any> {
run(): Promise<any> {
this.editorGroupService.arrangeGroups(GroupsArrangement.EVEN);
return Promise.resolve(false);
@@ -887,14 +887,14 @@ export class MaximizeGroupAction extends Action {
constructor(
id: string,
label: string,
@IEditorService private editorService: IEditorService,
@IEditorGroupsService private editorGroupService: IEditorGroupsService,
@IPartService private partService: IPartService
@IEditorService private readonly editorService: IEditorService,
@IEditorGroupsService private readonly editorGroupService: IEditorGroupsService,
@IPartService private readonly partService: IPartService
) {
super(id, label);
}
run(): Thenable<any> {
run(): Promise<any> {
if (this.editorService.activeEditor) {
this.editorGroupService.arrangeGroups(GroupsArrangement.MINIMIZE_OTHERS);
this.partService.setSideBarHidden(true);
@@ -915,7 +915,7 @@ export abstract class BaseNavigateEditorAction extends Action {
super(id, label);
}
run(): Thenable<any> {
run(): Promise<any> {
const result = this.navigate();
if (!result) {
return Promise.resolve(false);
@@ -964,7 +964,7 @@ export class OpenNextEditor extends BaseNavigateEditorAction {
return { editor: previousGroupEditors[0], groupId: nextGroup.id };
}
return void 0;
return undefined;
}
}
@@ -999,7 +999,7 @@ export class OpenPreviousEditor extends BaseNavigateEditorAction {
return { editor: previousGroupEditors[previousGroupEditors.length - 1], groupId: previousGroup.id };
}
return void 0;
return undefined;
}
}
@@ -1098,11 +1098,11 @@ export class NavigateForwardAction extends Action {
static readonly ID = 'workbench.action.navigateForward';
static readonly LABEL = nls.localize('navigateNext', "Go Forward");
constructor(id: string, label: string, @IHistoryService private historyService: IHistoryService) {
constructor(id: string, label: string, @IHistoryService private readonly historyService: IHistoryService) {
super(id, label);
}
run(): Thenable<any> {
run(): Promise<any> {
this.historyService.forward();
return Promise.resolve(null);
@@ -1114,11 +1114,11 @@ export class NavigateBackwardsAction extends Action {
static readonly ID = 'workbench.action.navigateBack';
static readonly LABEL = nls.localize('navigatePrevious', "Go Back");
constructor(id: string, label: string, @IHistoryService private historyService: IHistoryService) {
constructor(id: string, label: string, @IHistoryService private readonly historyService: IHistoryService) {
super(id, label);
}
run(): Thenable<any> {
run(): Promise<any> {
this.historyService.back();
return Promise.resolve(null);
@@ -1130,11 +1130,11 @@ export class NavigateToLastEditLocationAction extends Action {
static readonly ID = 'workbench.action.navigateToLastEditLocation';
static readonly LABEL = nls.localize('navigateToLastEditLocation', "Go to Last Edit Location");
constructor(id: string, label: string, @IHistoryService private historyService: IHistoryService) {
constructor(id: string, label: string, @IHistoryService private readonly historyService: IHistoryService) {
super(id, label);
}
run(): Thenable<any> {
run(): Promise<any> {
this.historyService.openLastEditLocation();
return Promise.resolve(null);
@@ -1146,11 +1146,11 @@ export class NavigateLastAction extends Action {
static readonly ID = 'workbench.action.navigateLast';
static readonly LABEL = nls.localize('navigateLast', "Go Last");
constructor(id: string, label: string, @IHistoryService private historyService: IHistoryService) {
constructor(id: string, label: string, @IHistoryService private readonly historyService: IHistoryService) {
super(id, label);
}
run(): Thenable<any> {
run(): Promise<any> {
this.historyService.last();
return Promise.resolve(null);
@@ -1165,12 +1165,12 @@ export class ReopenClosedEditorAction extends Action {
constructor(
id: string,
label: string,
@IHistoryService private historyService: IHistoryService
@IHistoryService private readonly historyService: IHistoryService
) {
super(id, label);
}
run(): Thenable<any> {
run(): Promise<any> {
this.historyService.reopenLastClosedEditor();
return Promise.resolve(false);
@@ -1185,13 +1185,13 @@ export class ClearRecentFilesAction extends Action {
constructor(
id: string,
label: string,
@IWindowsService private windowsService: IWindowsService,
@IHistoryService private historyService: IHistoryService
@IWindowsService private readonly windowsService: IWindowsService,
@IHistoryService private readonly historyService: IHistoryService
) {
super(id, label);
}
run(): Thenable<any> {
run(): Promise<any> {
// Clear global recently opened
this.windowsService.clearRecentlyOpened();
@@ -1232,13 +1232,13 @@ export class BaseQuickOpenEditorInGroupAction extends Action {
constructor(
id: string,
label: string,
@IQuickOpenService private quickOpenService: IQuickOpenService,
@IKeybindingService private keybindingService: IKeybindingService
@IQuickOpenService private readonly quickOpenService: IQuickOpenService,
@IKeybindingService private readonly keybindingService: IKeybindingService
) {
super(id, label);
}
run(): Thenable<any> {
run(): Promise<any> {
const keys = this.keybindingService.lookupKeybindings(this.id);
@@ -1287,13 +1287,13 @@ export class OpenPreviousEditorFromHistoryAction extends Action {
constructor(
id: string,
label: string,
@IQuickOpenService private quickOpenService: IQuickOpenService,
@IKeybindingService private keybindingService: IKeybindingService
@IQuickOpenService private readonly quickOpenService: IQuickOpenService,
@IKeybindingService private readonly keybindingService: IKeybindingService
) {
super(id, label);
}
run(): Thenable<any> {
run(): Promise<any> {
const keys = this.keybindingService.lookupKeybindings(this.id);
this.quickOpenService.show(null, { quickNavigateConfiguration: { keybindings: keys } });
@@ -1307,11 +1307,11 @@ export class OpenNextRecentlyUsedEditorAction extends Action {
static readonly ID = 'workbench.action.openNextRecentlyUsedEditor';
static readonly LABEL = nls.localize('openNextRecentlyUsedEditor', "Open Next Recently Used Editor");
constructor(id: string, label: string, @IHistoryService private historyService: IHistoryService) {
constructor(id: string, label: string, @IHistoryService private readonly historyService: IHistoryService) {
super(id, label);
}
run(): Thenable<any> {
run(): Promise<any> {
this.historyService.forward(true);
return Promise.resolve(null);
@@ -1323,11 +1323,11 @@ export class OpenPreviousRecentlyUsedEditorAction extends Action {
static readonly ID = 'workbench.action.openPreviousRecentlyUsedEditor';
static readonly LABEL = nls.localize('openPreviousRecentlyUsedEditor', "Open Previous Recently Used Editor");
constructor(id: string, label: string, @IHistoryService private historyService: IHistoryService) {
constructor(id: string, label: string, @IHistoryService private readonly historyService: IHistoryService) {
super(id, label);
}
run(): Thenable<any> {
run(): Promise<any> {
this.historyService.back(true);
return Promise.resolve(null);
@@ -1342,12 +1342,12 @@ export class ClearEditorHistoryAction extends Action {
constructor(
id: string,
label: string,
@IHistoryService private historyService: IHistoryService
@IHistoryService private readonly historyService: IHistoryService
) {
super(id, label);
}
run(): Thenable<any> {
run(): Promise<any> {
// Editor history
this.historyService.clear();
@@ -1619,7 +1619,7 @@ export class BaseCreateEditorGroupAction extends Action {
super(id, label);
}
run(): Thenable<any> {
run(): Promise<any> {
this.editorGroupService.addGroup(this.editorGroupService.activeGroup, this.direction, { activate: true });
return Promise.resolve(true);

View File

@@ -267,8 +267,8 @@ function registerDiffEditorCommands(): void {
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: TOGGLE_DIFF_SIDE_BY_SIDE,
weight: KeybindingWeight.WorkbenchContrib,
when: void 0,
primary: void 0,
when: undefined,
primary: undefined,
handler: accessor => toggleDiffSideBySide(accessor)
});
@@ -287,8 +287,8 @@ function registerDiffEditorCommands(): void {
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: TOGGLE_DIFF_IGNORE_TRIM_WHITESPACE,
weight: KeybindingWeight.WorkbenchContrib,
when: void 0,
primary: void 0,
when: undefined,
primary: undefined,
handler: accessor => toggleDiffIgnoreTrimWhitespace(accessor)
});
}
@@ -319,7 +319,7 @@ function registerOpenEditorAtIndexCommands(): void {
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: OPEN_EDITOR_AT_INDEX_COMMAND_ID + visibleIndex,
weight: KeybindingWeight.WorkbenchContrib,
when: void 0,
when: undefined,
primary: KeyMod.Alt | toKeyCode(visibleIndex),
mac: { primary: KeyMod.WinCtrl | toKeyCode(visibleIndex) },
handler: accessor => openEditorAtIndex(accessor, editorIndex)
@@ -340,7 +340,7 @@ function registerOpenEditorAtIndexCommands(): void {
case 9: return KeyCode.KEY_9;
}
return void 0;
return undefined;
}
}
@@ -351,7 +351,7 @@ function registerFocusEditorGroupAtIndexCommands(): void {
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: toCommandId(groupIndex),
weight: KeybindingWeight.WorkbenchContrib,
when: void 0,
when: undefined,
primary: KeyMod.CtrlCmd | toKeyCode(groupIndex),
handler: accessor => {
const editorGroupService = accessor.get(IEditorGroupsService);
@@ -392,7 +392,7 @@ function registerFocusEditorGroupAtIndexCommands(): void {
case 7: return 'workbench.action.focusEighthEditorGroup';
}
return void 0;
return undefined;
}
function toKeyCode(index: number): KeyCode {
@@ -406,7 +406,7 @@ function registerFocusEditorGroupAtIndexCommands(): void {
case 7: return KeyCode.KEY_8;
}
return void 0;
return undefined;
}
}
@@ -455,7 +455,7 @@ function registerCloseEditorCommands() {
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: CLOSE_SAVED_EDITORS_COMMAND_ID,
weight: KeybindingWeight.WorkbenchContrib,
when: void 0,
when: undefined,
primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyCode.KEY_U),
handler: (accessor, resourceOrContext: URI | IEditorCommandsContext, context?: IEditorCommandsContext) => {
const editorGroupService = accessor.get(IEditorGroupsService);
@@ -475,7 +475,7 @@ function registerCloseEditorCommands() {
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: CLOSE_EDITORS_IN_GROUP_COMMAND_ID,
weight: KeybindingWeight.WorkbenchContrib,
when: void 0,
when: undefined,
primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyCode.KEY_W),
handler: (accessor, resourceOrContext: URI | IEditorCommandsContext, context?: IEditorCommandsContext) => {
const editorGroupService = accessor.get(IEditorGroupsService);
@@ -495,7 +495,7 @@ function registerCloseEditorCommands() {
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: CLOSE_EDITOR_COMMAND_ID,
weight: KeybindingWeight.WorkbenchContrib,
when: void 0,
when: undefined,
primary: KeyMod.CtrlCmd | KeyCode.KEY_W,
win: { primary: KeyMod.CtrlCmd | KeyCode.F4, secondary: [KeyMod.CtrlCmd | KeyCode.KEY_W] },
handler: (accessor, resourceOrContext: URI | IEditorCommandsContext, context?: IEditorCommandsContext) => {
@@ -544,8 +544,8 @@ function registerCloseEditorCommands() {
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: CLOSE_OTHER_EDITORS_IN_GROUP_COMMAND_ID,
weight: KeybindingWeight.WorkbenchContrib,
when: void 0,
primary: void 0,
when: undefined,
primary: undefined,
mac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KEY_T },
handler: (accessor, resourceOrContext: URI | IEditorCommandsContext, context?: IEditorCommandsContext) => {
const editorGroupService = accessor.get(IEditorGroupsService);
@@ -573,8 +573,8 @@ function registerCloseEditorCommands() {
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: CLOSE_EDITORS_TO_THE_RIGHT_COMMAND_ID,
weight: KeybindingWeight.WorkbenchContrib,
when: void 0,
primary: void 0,
when: undefined,
primary: undefined,
handler: (accessor, resourceOrContext: URI | IEditorCommandsContext, context?: IEditorCommandsContext) => {
const editorGroupService = accessor.get(IEditorGroupsService);
@@ -590,7 +590,7 @@ function registerCloseEditorCommands() {
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: KEEP_EDITOR_COMMAND_ID,
weight: KeybindingWeight.WorkbenchContrib,
when: void 0,
when: undefined,
primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyCode.Enter),
handler: (accessor, resourceOrContext: URI | IEditorCommandsContext, context?: IEditorCommandsContext) => {
const editorGroupService = accessor.get(IEditorGroupsService);
@@ -607,8 +607,8 @@ function registerCloseEditorCommands() {
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: SHOW_EDITORS_IN_GROUP,
weight: KeybindingWeight.WorkbenchContrib,
when: void 0,
primary: void 0,
when: undefined,
primary: undefined,
handler: (accessor, resourceOrContext: URI | IEditorCommandsContext, context?: IEditorCommandsContext) => {
const editorGroupService = accessor.get(IEditorGroupsService);
const quickOpenService = accessor.get(IQuickOpenService);
@@ -638,7 +638,7 @@ function registerCloseEditorCommands() {
});
}
return void 0;
return undefined;
});
}
@@ -655,7 +655,7 @@ function getCommandsContext(resourceOrContext: URI | IEditorCommandsContext, con
return context;
}
return void 0;
return undefined;
}
function resolveCommandsContext(editorGroupService: IEditorGroupsService, context?: IEditorCommandsContext): { group: IEditorGroup, editor: IEditorInput, control: IEditor } {
@@ -682,7 +682,7 @@ export function getMultiSelectedEditorContexts(editorContext: IEditorCommandsCon
if (list instanceof List && list.getHTMLElement() === document.activeElement) {
const elementToContext = (element: IEditorIdentifier | IEditorGroup) => {
if (isEditorGroup(element)) {
return { groupId: element.id, editorIndex: void 0 };
return { groupId: element.id, editorIndex: undefined };
}
return { groupId: element.groupId, editorIndex: editorGroupService.getGroup(element.groupId).getIndexOfEditor(element.editor) };
@@ -690,11 +690,11 @@ export function getMultiSelectedEditorContexts(editorContext: IEditorCommandsCon
const onlyEditorGroupAndEditor = (e: IEditorIdentifier | IEditorGroup) => isEditorGroup(e) || isEditorIdentifier(e);
const focusedElements: (IEditorIdentifier | IEditorGroup)[] = list.getFocusedElements().filter(onlyEditorGroupAndEditor);
const focus = editorContext ? editorContext : focusedElements.length ? focusedElements.map(elementToContext)[0] : void 0; // need to take into account when editor context is { group: group }
const focusedElements: Array<IEditorIdentifier | IEditorGroup> = list.getFocusedElements().filter(onlyEditorGroupAndEditor);
const focus = editorContext ? editorContext : focusedElements.length ? focusedElements.map(elementToContext)[0] : undefined; // need to take into account when editor context is { group: group }
if (focus) {
const selection: (IEditorIdentifier | IEditorGroup)[] = list.getSelectedElements().filter(onlyEditorGroupAndEditor);
const selection: Array<IEditorIdentifier | IEditorGroup> = list.getSelectedElements().filter(onlyEditorGroupAndEditor);
// Only respect selection if it contains focused element
if (selection && selection.some(s => isEditorGroup(s) ? s.id === focus.groupId : s.groupId === focus.groupId && editorGroupService.getGroup(s.groupId).getIndexOfEditor(s.editor) === focus.editorIndex)) {

View File

@@ -8,7 +8,6 @@ import { EditorInput, EditorOptions } from 'vs/workbench/common/editor';
import { Dimension, show, hide, addClass } from 'vs/base/browser/dom';
import { Registry } from 'vs/platform/registry/common/platform';
import { IEditorRegistry, Extensions as EditorExtensions, IEditorDescriptor } from 'vs/workbench/browser/editor';
import { TPromise } from 'vs/base/common/winjs.base';
import { IPartService } from 'vs/workbench/services/part/common/partService';
import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
@@ -31,10 +30,10 @@ export class EditorControl extends Disposable {
private _onDidFocus: Emitter<void> = this._register(new Emitter<void>());
get onDidFocus(): Event<void> { return this._onDidFocus.event; }
private _onDidSizeConstraintsChange = this._register(new Emitter<{ width: number; height: number; }>());
get onDidSizeConstraintsChange(): Event<{ width: number; height: number; }> { return this._onDidSizeConstraintsChange.event; }
private _onDidSizeConstraintsChange = this._register(new Emitter<{ width: number; height: number; } | undefined>());
get onDidSizeConstraintsChange(): Event<{ width: number; height: number; } | undefined> { return this._onDidSizeConstraintsChange.event; }
private _activeControl: BaseEditor;
private _activeControl: BaseEditor | null;
private controls: BaseEditor[] = [];
private activeControlDisposeables: IDisposable[] = [];
@@ -44,8 +43,8 @@ export class EditorControl extends Disposable {
constructor(
private parent: HTMLElement,
private groupView: IEditorGroupView,
@IPartService private partService: IPartService,
@IInstantiationService private instantiationService: IInstantiationService,
@IPartService private readonly partService: IPartService,
@IInstantiationService private readonly instantiationService: IInstantiationService,
@IProgressService progressService: IProgressService
) {
super();
@@ -53,21 +52,24 @@ export class EditorControl extends Disposable {
this.editorOperation = this._register(new LongRunningOperation(progressService));
}
get activeControl(): BaseEditor {
get activeControl() {
return this._activeControl;
}
openEditor(editor: EditorInput, options?: EditorOptions): TPromise<IOpenEditorResult> {
openEditor(editor: EditorInput, options?: EditorOptions): Promise<IOpenEditorResult> {
// Editor control
const descriptor = Registry.as<IEditorRegistry>(EditorExtensions.Editors).getEditor(editor);
const control = this.doShowEditorControl(descriptor, options);
if (!descriptor) {
throw new Error('No editor descriptor found');
}
const control = this.doShowEditorControl(descriptor);
// Set input
return this.doSetInput(control, editor, options).then((editorChanged => (({ control, editorChanged } as IOpenEditorResult))));
return this.doSetInput(control, editor, options || null).then((editorChanged => (({ control, editorChanged } as IOpenEditorResult))));
}
private doShowEditorControl(descriptor: IEditorDescriptor, options: EditorOptions): BaseEditor {
private doShowEditorControl(descriptor: IEditorDescriptor): BaseEditor {
// Return early if the currently active editor control can handle the input
if (this._activeControl && descriptor.describes(this._activeControl)) {
@@ -130,7 +132,7 @@ export class EditorControl extends Disposable {
return control;
}
private doSetActiveControl(control: BaseEditor) {
private doSetActiveControl(control: BaseEditor | null) {
this._activeControl = control;
// Clear out previous active control listeners
@@ -143,10 +145,10 @@ export class EditorControl extends Disposable {
}
// Indicate that size constraints could have changed due to new editor
this._onDidSizeConstraintsChange.fire();
this._onDidSizeConstraintsChange.fire(undefined);
}
private doSetInput(control: BaseEditor, editor: EditorInput, options: EditorOptions): TPromise<boolean> {
private doSetInput(control: BaseEditor, editor: EditorInput, options: EditorOptions | null): Promise<boolean> {
// If the input did not change, return early and only apply the options
// unless the options instruct us to force open it even if it is the same
@@ -163,7 +165,7 @@ export class EditorControl extends Disposable {
control.focus();
}
return TPromise.as(false);
return Promise.resolve(false);
}
// Show progress while setting input after a certain timeout. If the workbench is opening
@@ -172,7 +174,7 @@ export class EditorControl extends Disposable {
// Call into editor control
const editorWillChange = !inputMatches;
return TPromise.wrap(control.setInput(editor, options, operation.token)).then(() => {
return control.setInput(editor, options, operation.token).then(() => {
// Focus (unless prevented or another operation is running)
if (operation.isCurrent()) {
@@ -191,7 +193,7 @@ export class EditorControl extends Disposable {
// Operation done
operation.stop();
return TPromise.wrapError(e);
return Promise.reject(e);
});
}

View File

@@ -96,7 +96,7 @@ class DropOverlay extends Themable {
private registerListeners(): void {
this._register(new DragAndDropObserver(this.container, {
onDragEnter: e => void 0,
onDragEnter: e => undefined,
onDragOver: e => {
const isDraggingGroup = this.groupTransfer.hasData(DraggedEditorGroupIdentifier.prototype);
const isDraggingEditor = this.editorTransfer.hasData(DraggedEditorIdentifier.prototype);
@@ -170,7 +170,7 @@ class DropOverlay extends Themable {
return this.accessor.getGroup(this.editorTransfer.getData(DraggedEditorIdentifier.prototype)[0].identifier.groupId);
}
return void 0;
return undefined;
}
private handleDrop(event: DragEvent, splitDirection?: GroupDirection): void {
@@ -303,7 +303,7 @@ class DropOverlay extends Themable {
mousePosX > edgeWidthThreshold && mousePosX < editorControlWidth - edgeWidthThreshold &&
mousePosY > edgeHeightThreshold && mousePosY < editorControlHeight - edgeHeightThreshold
) {
splitDirection = void 0;
splitDirection = undefined;
}
// Offer to split otherwise
@@ -413,7 +413,7 @@ class DropOverlay extends Themable {
removeClass(this.overlay, 'overlay-move-transition');
// Reset current operation
this.currentDropOperation = void 0;
this.currentDropOperation = undefined;
}
contains(element: HTMLElement): boolean {
@@ -440,7 +440,7 @@ export class EditorDropTarget extends Themable {
private accessor: IEditorGroupsAccessor,
private container: HTMLElement,
@IThemeService themeService: IThemeService,
@IInstantiationService private instantiationService: IInstantiationService
@IInstantiationService private readonly instantiationService: IInstantiationService
) {
super(themeService);
@@ -452,7 +452,7 @@ export class EditorDropTarget extends Themable {
return this._overlay;
}
return void 0;
return undefined;
}
private registerListeners(): void {
@@ -512,15 +512,13 @@ export class EditorDropTarget extends Themable {
private findTargetGroupView(child: HTMLElement): IEditorGroupView {
const groups = this.accessor.groups;
for (let i = 0; i < groups.length; i++) {
const groupView = groups[i];
for (const groupView of groups) {
if (isAncestor(child, groupView.element)) {
return groupView;
}
}
return void 0;
return undefined;
}
private updateContainer(isDraggedOver: boolean): void {
@@ -536,7 +534,7 @@ export class EditorDropTarget extends Themable {
private disposeOverlay(): void {
if (this.overlay) {
this.overlay.dispose();
this._overlay = void 0;
this._overlay = undefined;
}
}
}

View File

@@ -4,10 +4,9 @@
*--------------------------------------------------------------------------------------------*/
import 'vs/css!./media/editorgroupview';
import { TPromise } from 'vs/base/common/winjs.base';
import { EditorGroup, IEditorOpenOptions, EditorCloseEvent, ISerializedEditorGroup, isSerializedEditorGroup } from 'vs/workbench/common/editor/editorGroup';
import { EditorInput, EditorOptions, GroupIdentifier, ConfirmResult, SideBySideEditorInput, CloseDirection, IEditorCloseEvent, EditorGroupActiveEditorDirtyContext } from 'vs/workbench/common/editor';
import { Event, Emitter, once, Relay } from 'vs/base/common/event';
import { EditorInput, EditorOptions, GroupIdentifier, ConfirmResult, SideBySideEditorInput, CloseDirection, IEditorCloseEvent, EditorGroupActiveEditorDirtyContext, IEditor } from 'vs/workbench/common/editor';
import { Event, Emitter, Relay } from 'vs/base/common/event';
import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { addClass, addClasses, Dimension, trackFocus, toggleClass, removeClass, addDisposableListener, EventType, EventHelper, findParentWithClass, clearNode, isAncestor } from 'vs/base/browser/dom';
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
@@ -100,7 +99,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
private active: boolean;
private dimension: Dimension;
private _whenRestored: Thenable<void>;
private _whenRestored: Promise<void>;
private isRestored: boolean;
private scopedInstantiationService: IInstantiationService;
@@ -116,21 +115,21 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
private ignoreOpenEditorErrors: boolean;
private disposedEditorsWorker: RunOnceWorker<EditorInput>;
private mapEditorToPendingConfirmation: Map<EditorInput, TPromise<boolean>> = new Map<EditorInput, TPromise<boolean>>();
private mapEditorToPendingConfirmation: Map<EditorInput, Promise<boolean>> = new Map<EditorInput, Promise<boolean>>();
constructor(
private accessor: IEditorGroupsAccessor,
from: IEditorGroupView | ISerializedEditorGroup,
private _label: string,
@IInstantiationService private instantiationService: IInstantiationService,
@IContextKeyService private contextKeyService: IContextKeyService,
@IInstantiationService private readonly instantiationService: IInstantiationService,
@IContextKeyService private readonly contextKeyService: IContextKeyService,
@IThemeService themeService: IThemeService,
@INotificationService private notificationService: INotificationService,
@ITelemetryService private telemetryService: ITelemetryService,
@IUntitledEditorService private untitledEditorService: IUntitledEditorService,
@IKeybindingService private keybindingService: IKeybindingService,
@IMenuService private menuService: IMenuService,
@IContextMenuService private contextMenuService: IContextMenuService,
@INotificationService private readonly notificationService: INotificationService,
@ITelemetryService private readonly telemetryService: ITelemetryService,
@IUntitledEditorService private readonly untitledEditorService: IUntitledEditorService,
@IKeybindingService private readonly keybindingService: IKeybindingService,
@IMenuService private readonly menuService: IMenuService,
@IContextMenuService private readonly contextMenuService: IContextMenuService,
// {{SQL CARBON EDIT}}
@ICommandService private commandService: ICommandService
) {
@@ -141,7 +140,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
} else if (isSerializedEditorGroup(from)) {
this._group = this._register(instantiationService.createInstance(EditorGroup, from));
} else {
this._group = this._register(instantiationService.createInstance(EditorGroup, void 0));
this._group = this._register(instantiationService.createInstance(EditorGroup, undefined));
}
this.disposedEditorsWorker = this._register(new RunOnceWorker(editors => this.handleDisposedEditors(editors), 0));
@@ -283,9 +282,9 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
});
// Toolbar actions
const removeGroupAction = this._register(new Action(CLOSE_EDITOR_GROUP_COMMAND_ID, localize('closeGroupAction', "Close"), 'close-editor-group', true, () => { this.accessor.removeGroup(this); return TPromise.as(true); }));
const removeGroupAction = this._register(new Action(CLOSE_EDITOR_GROUP_COMMAND_ID, localize('closeGroupAction', "Close"), 'close-editor-group', true, () => { this.accessor.removeGroup(this); return Promise.resolve(true); }));
const keybinding = this.keybindingService.lookupKeybinding(removeGroupAction.id);
containerToolbar.push(removeGroupAction, { icon: true, label: false, keybinding: keybinding ? keybinding.getLabel() : void 0 });
containerToolbar.push(removeGroupAction, { icon: true, label: false, keybinding: keybinding ? keybinding.getLabel() : undefined });
}
private createContainerContextMenu(): void {
@@ -309,7 +308,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
// Fill in contributed actions
const actions: IAction[] = [];
fillInContextMenuActions(menu, void 0, actions, this.contextMenuService);
fillInContextMenuActions(menu, undefined, actions, this.contextMenuService);
// Show it
this.contextMenuService.showContextMenu({
@@ -334,7 +333,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
let target: HTMLElement;
if (e instanceof MouseEvent) {
if (e.button !== 0) {
return void 0; // only for left mouse click
return undefined; // only for left mouse click
}
target = e.target as HTMLElement;
@@ -404,9 +403,9 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
}
}
private restoreEditors(from: IEditorGroupView | ISerializedEditorGroup): Thenable<void> {
private restoreEditors(from: IEditorGroupView | ISerializedEditorGroup): Promise<void> {
if (this._group.count === 0) {
return Promise.resolve(void 0); // nothing to show
return Promise.resolve(); // nothing to show
}
// Determine editor options
@@ -491,7 +490,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
// Close the editor when it is no longer open in any group including diff editors
editorsToClose.forEach(editorToClose => {
const resource = editorToClose ? editorToClose.getResource() : void 0; // prefer resource to not close right-hand side editors of a diff editor
const resource = editorToClose ? editorToClose.getResource() : undefined; // prefer resource to not close right-hand side editors of a diff editor
if (!this.accessor.groups.some(groupView => groupView.group.contains(resource || editorToClose))) {
editorToClose.close();
}
@@ -609,7 +608,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
return this._disposed;
}
get whenRestored(): Thenable<void> {
get whenRestored(): Promise<void> {
return this._whenRestored;
}
@@ -660,7 +659,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
}
get activeControl(): BaseEditor {
return this.editorControl ? this.editorControl.activeControl : void 0;
return this.editorControl ? this.editorControl.activeControl : undefined;
}
get activeEditor(): EditorInput {
@@ -731,11 +730,11 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
//#region openEditor()
openEditor(editor: EditorInput, options?: EditorOptions): TPromise<void> {
openEditor(editor: EditorInput, options?: EditorOptions): Promise<IEditor | null> {
// Guard against invalid inputs
if (!editor) {
return TPromise.as(void 0);
return Promise.resolve(null);
}
// Editor opening event allows for prevention
@@ -750,11 +749,11 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
return this.doOpenEditor(editor, options);
}
private doOpenEditor(editor: EditorInput, options?: EditorOptions): TPromise<void> {
private doOpenEditor(editor: EditorInput, options?: EditorOptions): Promise<IEditor> {
// Determine options
const openEditorOptions: IEditorOpenOptions = {
index: options ? options.index : void 0,
index: options ? options.index : undefined,
pinned: !this.accessor.partOptions.enablePreview || editor.isDirty() || (options && options.pinned) || (options && typeof options.index === 'number'),
active: this._group.count === 0 || !options || !options.inactive
};
@@ -791,10 +790,10 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
return this.doShowEditor(editor, openEditorOptions.active, options);
}
private doShowEditor(editor: EditorInput, active: boolean, options?: EditorOptions): TPromise<void> {
private doShowEditor(editor: EditorInput, active: boolean, options?: EditorOptions): Promise<IEditor> {
// Show in editor control if the active editor changed
let openEditorPromise: TPromise<void>;
let openEditorPromise: Promise<IEditor>;
if (active) {
openEditorPromise = this.editorControl.openEditor(editor, options).then(result => {
@@ -802,13 +801,17 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
if (result.editorChanged) {
this._onDidGroupChange.fire({ kind: GroupChangeKind.EDITOR_ACTIVE, editor });
}
return result.control;
}, error => {
// Handle errors but do not bubble them up
this.doHandleOpenEditorError(error, editor, options);
return null; // error: return NULL as result to signal this
});
} else {
openEditorPromise = TPromise.as(void 0);
openEditorPromise = Promise.resolve(null); // inactive: return NULL as result to signal this
}
// Show in title control after editor control because some actions depend on it
@@ -833,7 +836,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
actions
});
once(handle.onDidClose)(() => dispose(actions.primary));
Event.once(handle.onDidClose)(() => dispose(actions.primary));
}
// Event
@@ -850,17 +853,21 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
//#region openEditors()
openEditors(editors: { editor: EditorInput, options?: EditorOptions }[]): TPromise<void> {
openEditors(editors: { editor: EditorInput, options?: EditorOptions }[]): Promise<IEditor | null> {
if (!editors.length) {
return TPromise.as(void 0);
return Promise.resolve(null);
}
// Do not modify original array
editors = editors.slice(0);
let result: IEditor;
// Use the first editor as active editor
const { editor, options } = editors.shift();
return this.openEditor(editor, options).then(() => {
return this.openEditor(editor, options).then(activeEditor => {
result = activeEditor; // this can be NULL if the opening failed
const startingIndex = this.getIndexOfEditor(editor) + 1;
// Open the other ones inactive
@@ -870,8 +877,12 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
adjustedEditorOptions.pinned = true;
adjustedEditorOptions.index = startingIndex + index;
return this.openEditor(editor, adjustedEditorOptions);
})).then(() => void 0);
return this.openEditor(editor, adjustedEditorOptions).then(activeEditor => {
if (!result) {
result = activeEditor; // only take if the first editor opening failed
}
});
})).then(() => result);
});
}
@@ -893,7 +904,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
}
private doMoveEditorInsideGroup(editor: EditorInput, moveOptions?: IMoveEditorOptions): void {
const moveToIndex = moveOptions ? moveOptions.index : void 0;
const moveToIndex = moveOptions ? moveOptions.index : undefined;
if (typeof moveToIndex !== 'number') {
return; // do nothing if we move into same group without index
}
@@ -953,9 +964,9 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
//#region closeEditor()
closeEditor(editor: EditorInput = this.activeEditor): TPromise<void> {
closeEditor(editor: EditorInput = this.activeEditor): Promise<void> {
if (!editor) {
return TPromise.as(void 0);
return Promise.resolve();
}
// Check for dirty and veto
@@ -1025,7 +1036,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
this.ignoreOpenEditorErrors = true;
}
const options = !focusNext ? EditorOptions.create({ preserveFocus: true }) : void 0;
const options = !focusNext ? EditorOptions.create({ preserveFocus: true }) : undefined;
this.openEditor(nextActiveEditor, options).then(() => {
this.ignoreOpenEditorErrors = false;
});
@@ -1069,9 +1080,9 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
this._group.closeEditor(editor);
}
private handleDirty(editors: EditorInput[]): TPromise<boolean /* veto */> {
private handleDirty(editors: EditorInput[]): Promise<boolean /* veto */> {
if (!editors.length) {
return TPromise.as(false); // no veto
return Promise.resolve(false); // no veto
}
const editor = editors.shift();
@@ -1099,13 +1110,13 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
});
}
private doHandleDirty(editor: EditorInput): TPromise<boolean /* veto */> {
private doHandleDirty(editor: EditorInput): Promise<boolean /* veto */> {
if (
!editor.isDirty() || // editor must be dirty
this.accessor.groups.some(groupView => groupView !== this && groupView.group.contains(editor, true /* support side by side */)) || // editor is opened in other group
editor instanceof SideBySideEditorInput && this.isOpened(editor.master) // side by side editor master is still opened
) {
return TPromise.as(false);
return Promise.resolve(false);
}
// Switch to editor that we want to handle and confirm to save/revert
@@ -1146,9 +1157,9 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
//#region closeEditors()
closeEditors(args: EditorInput[] | ICloseEditorsFilter): TPromise<void> {
closeEditors(args: EditorInput[] | ICloseEditorsFilter): Promise<void> {
if (this.isEmpty()) {
return TPromise.as(void 0);
return Promise.resolve();
}
const editors = this.getEditorsToClose(args);
@@ -1219,7 +1230,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
//#region closeAllEditors()
closeAllEditors(): TPromise<void> {
closeAllEditors(): Promise<void> {
if (this.isEmpty()) {
// If the group is empty and the request is to close all editors, we still close
@@ -1229,7 +1240,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
this.accessor.removeGroup(this);
}
return TPromise.as(void 0);
return Promise.resolve();
}
// Check for dirty and veto
@@ -1264,7 +1275,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
//#region replaceEditors()
replaceEditors(editors: EditorReplacement[]): TPromise<void> {
replaceEditors(editors: EditorReplacement[]): Promise<void> {
// Extract active vs. inactive replacements
let activeReplacement: EditorReplacement;
@@ -1322,10 +1333,10 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
// Forward to title control
this.titleAreaControl.closeEditor(activeReplacement.editor);
return openEditorResult;
return openEditorResult.then(() => undefined);
}
return TPromise.as(void 0);
return Promise.resolve();
}
//#endregion
@@ -1379,6 +1390,10 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
layout(width: number, height: number): void {
this.dimension = new Dimension(width, height);
// Ensure editor container gets height as CSS depending
// on the preferred height of the title control
this.editorContainer.style.height = `calc(100% - ${this.titleAreaControl.getPreferredHeight()}px)`;
// Forward to controls
this.titleAreaControl.layout(new Dimension(this.dimension.width, this.titleAreaControl.getPreferredHeight()));
this.editorControl.layout(new Dimension(this.dimension.width, this.dimension.height - this.titleAreaControl.getPreferredHeight()));
@@ -1410,7 +1425,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
}
class EditorOpeningEvent implements IEditorOpeningEvent {
private override: () => TPromise<any>;
private override: () => Promise<IEditor>;
constructor(
private _group: GroupIdentifier,
@@ -1431,11 +1446,11 @@ class EditorOpeningEvent implements IEditorOpeningEvent {
return this._options;
}
prevent(callback: () => TPromise<any>): void {
prevent(callback: () => Promise<IEditor>): void {
this.override = callback;
}
isPrevented(): () => TPromise<any> {
isPrevented(): () => Promise<IEditor> {
return this.override;
}
}
@@ -1451,7 +1466,7 @@ registerThemingParticipant((theme, collector, environment) => {
// Letterpress
const letterpress = `resources/letterpress${theme.type === 'dark' ? '-dark' : theme.type === 'hc' ? '-hc' : ''}.svg`;
collector.addRule(`
.monaco-workbench > .part.editor > .content .editor-group-container.empty .editor-group-letterpress {
.monaco-workbench .part.editor > .content .editor-group-container.empty .editor-group-letterpress {
background-image: url('${URI.file(join(environment.appRoot, letterpress)).toString()}')
}
`);
@@ -1460,20 +1475,20 @@ registerThemingParticipant((theme, collector, environment) => {
const focusedEmptyGroupBorder = theme.getColor(EDITOR_GROUP_FOCUSED_EMPTY_BORDER);
if (focusedEmptyGroupBorder) {
collector.addRule(`
.monaco-workbench > .part.editor > .content:not(.empty) .editor-group-container.empty.active:focus {
.monaco-workbench .part.editor > .content:not(.empty) .editor-group-container.empty.active:focus {
outline-width: 1px;
outline-color: ${focusedEmptyGroupBorder};
outline-offset: -2px;
outline-style: solid;
}
.monaco-workbench > .part.editor > .content.empty .editor-group-container.empty.active:focus {
.monaco-workbench .part.editor > .content.empty .editor-group-container.empty.active:focus {
outline: none; /* never show outline for empty group if it is the last */
}
`);
} else {
collector.addRule(`
.monaco-workbench > .part.editor > .content .editor-group-container.empty.active:focus {
.monaco-workbench .part.editor > .content .editor-group-container.empty.active:focus {
outline: none; /* disable focus outline unless active empty group border is defined */
}
`);

View File

@@ -7,11 +7,11 @@ import 'vs/workbench/browser/parts/editor/editor.contribution';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { Part } from 'vs/workbench/browser/part';
import { Dimension, isAncestor, toggleClass, addClass, $ } from 'vs/base/browser/dom';
import { Event, Emitter, once, Relay, anyEvent } from 'vs/base/common/event';
import { Event, Emitter, Relay } from 'vs/base/common/event';
import { contrastBorder, editorBackground } from 'vs/platform/theme/common/colorRegistry';
import { GroupDirection, IAddGroupOptions, GroupsArrangement, GroupOrientation, IMergeGroupOptions, MergeGroupMode, ICopyEditorOptions, GroupsOrder, GroupChangeKind, GroupLocation, IFindGroupScope, EditorGroupLayout, GroupLayoutArgument } from 'vs/workbench/services/group/common/editorGroupsService';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { Direction, SerializableGrid, Sizing, ISerializedGrid, Orientation, GridBranchNode, isGridBranchNode, GridNode, createSerializedGrid, Grid } from 'vs/base/browser/ui/grid/grid';
import { Direction, SerializableGrid, Sizing, ISerializedGrid, Orientation, GridBranchNode, isGridBranchNode, GridNode, createSerializedGrid, Grid, ISerializableView } from 'vs/base/browser/ui/grid/grid';
import { GroupIdentifier, IWorkbenchEditorConfiguration } from 'vs/workbench/common/editor';
import { values } from 'vs/base/common/map';
import { EDITOR_GROUP_BORDER, EDITOR_PANE_BACKGROUND } from 'vs/workbench/common/theme';
@@ -23,13 +23,13 @@ import { IDisposable, dispose, toDisposable } from 'vs/base/common/lifecycle';
import { assign } from 'vs/base/common/objects';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import { ISerializedEditorGroup, isSerializedEditorGroup } from 'vs/workbench/common/editor/editorGroup';
import { always } from 'vs/base/common/async';
import { EditorDropTarget } from 'vs/workbench/browser/parts/editor/editorDropTarget';
import { localize } from 'vs/nls';
import { Color } from 'vs/base/common/color';
import { CenteredViewLayout } from 'vs/base/browser/ui/centered/centeredViewLayout';
import { IView, orthogonal } from 'vs/base/browser/ui/grid/gridview';
import { IView, orthogonal, LayoutPriority } from 'vs/base/browser/ui/grid/gridview';
import { onUnexpectedError } from 'vs/base/common/errors';
import { Parts } from 'vs/workbench/services/part/common/partService';
// {{SQL CARBON EDIT}}
import { convertEditorInput } from 'sql/parts/common/customInputConverter';
@@ -83,7 +83,7 @@ class GridWidgetView<T extends IView> implements IView {
}
}
export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditorGroupsAccessor {
export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditorGroupsAccessor, ISerializableView {
_serviceBrand: any;
@@ -109,11 +109,14 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor
private onDidSetGridWidget = this._register(new Emitter<{ width: number; height: number; }>());
private _onDidSizeConstraintsChange = this._register(new Relay<{ width: number; height: number; }>());
get onDidSizeConstraintsChange(): Event<{ width: number; height: number; }> { return anyEvent(this.onDidSetGridWidget.event, this._onDidSizeConstraintsChange.event); }
get onDidSizeConstraintsChange(): Event<{ width: number; height: number; }> { return Event.any(this.onDidSetGridWidget.event, this._onDidSizeConstraintsChange.event); }
private _onDidPreferredSizeChange: Emitter<void> = this._register(new Emitter<void>());
get onDidPreferredSizeChange(): Event<void> { return this._onDidPreferredSizeChange.event; }
private _onDidActivateGroup: Emitter<IEditorGroupView> = this._register(new Emitter<IEditorGroupView>());
get onDidActivateGroup(): Event<IEditorGroupView> { return this._onDidActivateGroup.event; }
//#endregion
private dimension: Dimension;
@@ -133,15 +136,22 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor
private gridWidget: SerializableGrid<IEditorGroupView>;
private gridWidgetView: GridWidgetView<IEditorGroupView>;
private _whenRestored: Thenable<void>;
private _whenRestored: Promise<void>;
private whenRestoredResolve: () => void;
element: HTMLElement;
private _onDidChange = new Emitter<{ width: number; height: number; }>();
readonly onDidChange = this._onDidChange.event;
priority: LayoutPriority = LayoutPriority.High;
constructor(
id: string,
private restorePreviousState: boolean,
@IInstantiationService private instantiationService: IInstantiationService,
@IInstantiationService private readonly instantiationService: IInstantiationService,
@IThemeService themeService: IThemeService,
@IConfigurationService private configurationService: IConfigurationService,
@IConfigurationService private readonly configurationService: IConfigurationService,
@IStorageService storageService: IStorageService
) {
super(id, { hasTitle: false }, themeService, storageService);
@@ -220,13 +230,13 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor
get orientation(): GroupOrientation {
if (!this.gridWidget) {
return void 0; // we have not been created yet
return undefined; // we have not been created yet
}
return this.gridWidget.orientation === Orientation.VERTICAL ? GroupOrientation.VERTICAL : GroupOrientation.HORIZONTAL;
}
get whenRestored(): Thenable<void> {
get whenRestored(): Promise<void> {
return this._whenRestored;
}
@@ -316,6 +326,7 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor
const groupView = this.assertGroupView(group);
this.doSetGroupActive(groupView);
this._onDidActivateGroup.fire(groupView);
return groupView;
}
@@ -527,7 +538,7 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor
}));
// Track dispose
once(groupView.onWillDispose)(() => {
Event.once(groupView.onWillDispose)(() => {
groupDisposables = dispose(groupDisposables);
this.groupViews.delete(groupView.id);
this.doUpdateMostRecentActive(groupView);
@@ -762,7 +773,7 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor
private resetPreferredSize(): void {
// Reset (will be computed upon next access)
this._preferredSize = void 0;
this._preferredSize = undefined;
// Event
this._onDidPreferredSizeChange.fire();
@@ -783,6 +794,7 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor
createContentArea(parent: HTMLElement): HTMLElement {
// Container
this.element = parent;
this.container = document.createElement('div');
addClass(this.container, 'content');
parent.appendChild(this.container);
@@ -824,7 +836,7 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor
}
// Signal restored
always(Promise.all(this.groups.map(group => group.whenRestored)), () => this.whenRestoredResolve());
Promise.all(this.groups.map(group => group.whenRestored)).finally(() => this.whenRestoredResolve());
// Update container
this.updateContainer();
@@ -861,7 +873,7 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor
this.groupViews.forEach(group => group.dispose());
this.groupViews.clear();
this._activeGroup = void 0;
this._activeGroup = undefined;
this.mostRecentActiveGroups = [];
}
@@ -924,7 +936,7 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor
this._onDidSizeConstraintsChange.input = gridWidget.onDidChange;
}
this.onDidSetGridWidget.fire();
this.onDidSetGridWidget.fire(undefined);
}
private updateContainer(): void {
@@ -950,12 +962,16 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor
return this.groupViews.size === 1 && this._activeGroup.isEmpty();
}
layout(dimension: Dimension): Dimension[] {
const sizes = super.layout(dimension);
layout(dimension: Dimension): Dimension[];
layout(width: number, height: number): void;
layout(dim1: Dimension | number, dim2?: number): Dimension[] | void {
const sizes = super.layout(dim1 instanceof Dimension ? dim1 : new Dimension(dim1, dim2));
this.doLayout(sizes[1]);
return sizes;
if (dim1 instanceof Dimension) {
return sizes;
}
}
private doLayout(dimension: Dimension): void {
@@ -1016,4 +1032,10 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor
}
//#endregion
}
toJSON(): object {
return {
type: Parts.EDITOR_PART
};
}
}

View File

@@ -25,8 +25,8 @@ export class EditorPickerEntry extends QuickOpenEntryGroup {
constructor(
private editor: EditorInput,
private _group: IEditorGroup,
@IModeService private modeService: IModeService,
@IModelService private modelService: IModelService
@IModeService private readonly modeService: IModeService,
@IModelService private readonly modelService: IModelService
) {
super();
}
@@ -90,7 +90,7 @@ export abstract class BaseEditorPicker extends QuickOpenHandler {
this.scorerCache = Object.create(null);
}
getResults(searchValue: string, token: CancellationToken): Thenable<QuickOpenModel> {
getResults(searchValue: string, token: CancellationToken): Promise<QuickOpenModel | null> {
const editorEntries = this.getEditorEntries();
if (!editorEntries.length) {
return Promise.resolve(null);

View File

@@ -50,7 +50,7 @@ import { IQuickInputService, IQuickPickItem, QuickPickInput } from 'vs/platform/
import { getIconClasses } from 'vs/editor/common/services/getIconClasses';
import { timeout } from 'vs/base/common/async';
import { INotificationHandle, INotificationService, Severity } from 'vs/platform/notification/common/notification';
import { once } from 'vs/base/common/event';
import { Event } from 'vs/base/common/event';
class SideBySideEditorEncodingSupport implements IEncodingSupport {
constructor(private master: IEncodingSupport, private details: IEncodingSupport) { }
@@ -290,12 +290,12 @@ export class EditorStatus implements IStatusbarItem {
private screenReaderNotification: INotificationHandle;
constructor(
@IEditorService private editorService: IEditorService,
@IQuickOpenService private quickOpenService: IQuickOpenService,
@IInstantiationService private instantiationService: IInstantiationService,
@IUntitledEditorService private untitledEditorService: IUntitledEditorService,
@IModeService private modeService: IModeService,
@ITextFileService private textFileService: ITextFileService,
@IEditorService private readonly editorService: IEditorService,
@IQuickOpenService private readonly quickOpenService: IQuickOpenService,
@IInstantiationService private readonly instantiationService: IInstantiationService,
@IUntitledEditorService private readonly untitledEditorService: IUntitledEditorService,
@IModeService private readonly modeService: IModeService,
@ITextFileService private readonly textFileService: ITextFileService,
@IWorkspaceConfigurationService private readonly configurationService: IWorkspaceConfigurationService,
@INotificationService private readonly notificationService: INotificationService
) {
@@ -518,7 +518,7 @@ export class EditorStatus implements IStatusbarItem {
{ sticky: true }
);
once(this.screenReaderNotification.onDidClose)(() => {
Event.once(this.screenReaderNotification.onDidClose)(() => {
this.screenReaderNotification = null;
});
}
@@ -548,7 +548,7 @@ export class EditorStatus implements IStatusbarItem {
private updateStatusBar(): void {
const activeControl = this.editorService.activeControl;
const activeCodeEditor = activeControl ? getCodeEditor(activeControl.getControl()) : void 0;
const activeCodeEditor = activeControl ? getCodeEditor(activeControl.getControl()) : undefined;
// Update all states
this.onScreenReaderModeChange(activeCodeEditor);
@@ -587,8 +587,8 @@ export class EditorStatus implements IStatusbarItem {
this.onEOLChange(activeCodeEditor);
let selections = activeCodeEditor.getSelections();
for (let i = 0; i < e.changes.length; i++) {
if (selections.some(selection => Range.areIntersecting(selection, e.changes[i].range))) {
for (const change of e.changes) {
if (selections.some(selection => Range.areIntersecting(selection, change.range))) {
this.onSelectionChange(activeCodeEditor);
break;
}
@@ -820,7 +820,7 @@ export class ShowLanguageExtensionsAction extends Action {
constructor(
private fileExtension: string,
@ICommandService private commandService: ICommandService,
@ICommandService private readonly commandService: ICommandService,
@IExtensionGalleryService galleryService: IExtensionGalleryService
) {
super(ShowLanguageExtensionsAction.ID, nls.localize('showLanguageExtensions', "Search Marketplace Extensions for '{0}'...", fileExtension));
@@ -828,8 +828,8 @@ export class ShowLanguageExtensionsAction extends Action {
this.enabled = galleryService.isEnabled();
}
run(): Thenable<void> {
return this.commandService.executeCommand('workbench.extensions.action.showExtensionsForLanguage', this.fileExtension).then(() => void 0);
run(): Promise<void> {
return this.commandService.executeCommand('workbench.extensions.action.showExtensionsForLanguage', this.fileExtension).then(() => undefined);
}
}
@@ -841,19 +841,19 @@ export class ChangeModeAction extends Action {
constructor(
actionId: string,
actionLabel: string,
@IModeService private modeService: IModeService,
@IModelService private modelService: IModelService,
@IEditorService private editorService: IEditorService,
@IWorkspaceConfigurationService private configurationService: IWorkspaceConfigurationService,
@IQuickInputService private quickInputService: IQuickInputService,
@IPreferencesService private preferencesService: IPreferencesService,
@IInstantiationService private instantiationService: IInstantiationService,
@IUntitledEditorService private untitledEditorService: IUntitledEditorService
@IModeService private readonly modeService: IModeService,
@IModelService private readonly modelService: IModelService,
@IEditorService private readonly editorService: IEditorService,
@IWorkspaceConfigurationService private readonly configurationService: IWorkspaceConfigurationService,
@IQuickInputService private readonly quickInputService: IQuickInputService,
@IPreferencesService private readonly preferencesService: IPreferencesService,
@IInstantiationService private readonly instantiationService: IInstantiationService,
@IUntitledEditorService private readonly untitledEditorService: IUntitledEditorService
) {
super(actionId, actionLabel);
}
run(): Thenable<any> {
run(): Promise<any> {
const activeTextEditorWidget = getCodeEditor(this.editorService.activeTextEditorWidget);
if (!activeTextEditorWidget) {
return this.quickInputService.pick([{ label: nls.localize('noEditor', "No text editor active at this time") }]);
@@ -958,6 +958,7 @@ export class ChangeModeAction extends Action {
}
// Change mode for active editor
// {{SQL CARBON EDIT}} - Get activeControl instead of activeEditor
const activeEditor = this.editorService.activeControl;
const activeTextEditorWidget = this.editorService.activeTextEditorWidget;
const models: ITextModel[] = [];
@@ -1012,7 +1013,7 @@ export class ChangeModeAction extends Action {
return <IQuickPickItem>{
id,
label: lang,
description: (id === currentAssociation) ? nls.localize('currentAssociation', "Current Association") : void 0
description: (id === currentAssociation) ? nls.localize('currentAssociation', "Current Association") : undefined
};
});
@@ -1061,13 +1062,13 @@ class ChangeIndentationAction extends Action {
constructor(
actionId: string,
actionLabel: string,
@IEditorService private editorService: IEditorService,
@IQuickInputService private quickInputService: IQuickInputService
@IEditorService private readonly editorService: IEditorService,
@IQuickInputService private readonly quickInputService: IQuickInputService
) {
super(actionId, actionLabel);
}
run(): Thenable<any> {
run(): Promise<any> {
const activeTextEditorWidget = getCodeEditor(this.editorService.activeTextEditorWidget);
if (!activeTextEditorWidget) {
return this.quickInputService.pick([{ label: nls.localize('noEditor', "No text editor active at this time") }]);
@@ -1111,13 +1112,13 @@ export class ChangeEOLAction extends Action {
constructor(
actionId: string,
actionLabel: string,
@IEditorService private editorService: IEditorService,
@IQuickInputService private quickInputService: IQuickInputService
@IEditorService private readonly editorService: IEditorService,
@IQuickInputService private readonly quickInputService: IQuickInputService
) {
super(actionId, actionLabel);
}
run(): Thenable<any> {
run(): Promise<any> {
const activeTextEditorWidget = getCodeEditor(this.editorService.activeTextEditorWidget);
if (!activeTextEditorWidget) {
return this.quickInputService.pick([{ label: nls.localize('noEditor', "No text editor active at this time") }]);
@@ -1156,15 +1157,15 @@ export class ChangeEncodingAction extends Action {
constructor(
actionId: string,
actionLabel: string,
@IEditorService private editorService: IEditorService,
@IQuickInputService private quickInputService: IQuickInputService,
@ITextResourceConfigurationService private textResourceConfigurationService: ITextResourceConfigurationService,
@IFileService private fileService: IFileService
@IEditorService private readonly editorService: IEditorService,
@IQuickInputService private readonly quickInputService: IQuickInputService,
@ITextResourceConfigurationService private readonly textResourceConfigurationService: ITextResourceConfigurationService,
@IFileService private readonly fileService: IFileService
) {
super(actionId, actionLabel);
}
run(): Thenable<any> {
run(): Promise<any> {
if (!getCodeEditor(this.editorService.activeTextEditorWidget)) {
return this.quickInputService.pick([{ label: nls.localize('noEditor', "No text editor active at this time") }]);
}
@@ -1196,7 +1197,7 @@ export class ChangeEncodingAction extends Action {
return pickActionPromise.then(action => {
if (!action) {
return void 0;
return undefined;
}
const resource = toResource(activeControl.input, { supportSideBySide: true });

View File

@@ -34,7 +34,7 @@ export class FloatingClickWidget extends Widget implements IOverlayWidget {
private label: string,
keyBindingAction: string,
@IKeybindingService keybindingService: IKeybindingService,
@IThemeService private themeService: IThemeService
@IThemeService private readonly themeService: IThemeService
) {
super();
@@ -106,9 +106,9 @@ export class OpenWorkspaceButtonContribution extends Disposable implements IEdit
constructor(
private editor: ICodeEditor,
@IInstantiationService private instantiationService: IInstantiationService,
@IWindowService private windowService: IWindowService,
@IWorkspaceContextService private contextService: IWorkspaceContextService
@IInstantiationService private readonly instantiationService: IInstantiationService,
@IWindowService private readonly windowService: IWindowService,
@IWorkspaceContextService private readonly contextService: IWorkspaceContextService
) {
super();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 381 B

After

Width:  |  Height:  |  Size: 266 B

View File

@@ -3,17 +3,17 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
.monaco-workbench>.part.editor>.content .editor-group-container .breadcrumbs-control.hidden {
.monaco-workbench .part.editor>.content .editor-group-container .breadcrumbs-control.hidden {
display: none;
}
.monaco-workbench>.part.editor>.content .editor-group-container .breadcrumbs-control .monaco-breadcrumb-item.selected .monaco-icon-label,
.monaco-workbench>.part.editor>.content .editor-group-container .breadcrumbs-control .monaco-breadcrumb-item.focused .monaco-icon-label {
.monaco-workbench .part.editor>.content .editor-group-container .breadcrumbs-control .monaco-breadcrumb-item.selected .monaco-icon-label,
.monaco-workbench .part.editor>.content .editor-group-container .breadcrumbs-control .monaco-breadcrumb-item.focused .monaco-icon-label {
text-decoration-line: underline;
}
.monaco-workbench>.part.editor>.content .editor-group-container .breadcrumbs-control .monaco-breadcrumb-item.selected .hint-more,
.monaco-workbench>.part.editor>.content .editor-group-container .breadcrumbs-control .monaco-breadcrumb-item.focused .hint-more {
.monaco-workbench .part.editor>.content .editor-group-container .breadcrumbs-control .monaco-breadcrumb-item.selected .hint-more,
.monaco-workbench .part.editor>.content .editor-group-container .breadcrumbs-control .monaco-breadcrumb-item.focused .hint-more {
text-decoration-line: underline;
}

View File

@@ -5,26 +5,26 @@
/* Container */
.monaco-workbench > .part.editor > .content .editor-group-container {
.monaco-workbench .part.editor > .content .editor-group-container {
height: 100%;
}
.monaco-workbench > .part.editor > .content .editor-group-container.empty {
.monaco-workbench .part.editor > .content .editor-group-container.empty {
opacity: 0.5; /* dimmed to indicate inactive state */
}
.monaco-workbench > .part.editor > .content .editor-group-container.empty.active,
.monaco-workbench > .part.editor > .content .editor-group-container.empty.dragged-over {
.monaco-workbench .part.editor > .content .editor-group-container.empty.active,
.monaco-workbench .part.editor > .content .editor-group-container.empty.dragged-over {
opacity: 1; /* indicate active/dragged-over group through undimmed state */
}
/* Letterpress */
.monaco-workbench > .part.editor > .content .editor-group-container > .editor-group-letterpress {
.monaco-workbench .part.editor > .content .editor-group-container > .editor-group-letterpress {
display: none; /* only visible when empty */
}
.monaco-workbench > .part.editor > .content .editor-group-container.empty > .editor-group-letterpress {
.monaco-workbench .part.editor > .content .editor-group-container.empty > .editor-group-letterpress {
display: block;
margin: auto;
width: 100%;
@@ -35,25 +35,25 @@
background-size: 70% 70%;
}
.monaco-workbench > .part.editor > .content.empty .editor-group-container.empty > .editor-group-letterpress {
.monaco-workbench .part.editor > .content.empty .editor-group-container.empty > .editor-group-letterpress {
background-size: 100% 100%; /* larger for empty editor part */
height: 100%; /* no toolbar in this case */
}
/* Title */
.monaco-workbench > .part.editor > .content .editor-group-container > .title {
.monaco-workbench .part.editor > .content .editor-group-container > .title {
position: relative;
box-sizing: border-box;
overflow: hidden;
}
.monaco-workbench > .part.editor > .content .editor-group-container > .title:not(.tabs) {
.monaco-workbench .part.editor > .content .editor-group-container > .title:not(.tabs) {
display: flex; /* when tabs are not shown, use flex layout */
flex-wrap: nowrap;
}
.monaco-workbench > .part.editor > .content .editor-group-container > .title.title-border-bottom::after {
.monaco-workbench .part.editor > .content .editor-group-container > .title.title-border-bottom::after {
content: '';
position: absolute;
bottom: 0;
@@ -65,21 +65,21 @@
height: 1px;
}
.monaco-workbench > .part.editor > .content .editor-group-container.empty > .title {
.monaco-workbench .part.editor > .content .editor-group-container.empty > .title {
display: none;
}
/* Toolbar */
.monaco-workbench > .part.editor > .content .editor-group-container > .editor-group-container-toolbar {
.monaco-workbench .part.editor > .content .editor-group-container > .editor-group-container-toolbar {
display: none;
}
.monaco-workbench > .part.editor > .content:not(.empty) .editor-group-container.empty > .editor-group-container-toolbar {
.monaco-workbench .part.editor > .content:not(.empty) .editor-group-container.empty > .editor-group-container-toolbar {
display: block;
}
.monaco-workbench > .part.editor > .content .editor-group-container > .editor-group-container-toolbar .action-label {
.monaco-workbench .part.editor > .content .editor-group-container > .editor-group-container-toolbar .action-label {
display: block;
height: 35px;
line-height: 35px;
@@ -89,30 +89,26 @@
background-repeat: no-repeat;
}
.vs .monaco-workbench > .part.editor > .content .editor-group-container > .editor-group-container-toolbar .close-editor-group {
.vs .monaco-workbench .part.editor > .content .editor-group-container > .editor-group-container-toolbar .close-editor-group {
background-image: url('close-big.svg');
}
.vs-dark .monaco-workbench > .part.editor > .content .editor-group-container > .editor-group-container-toolbar .close-editor-group,
.hc-black .monaco-workbench > .part.editor > .content .editor-group-container > .editor-group-container-toolbar .close-editor-group {
.vs-dark .monaco-workbench .part.editor > .content .editor-group-container > .editor-group-container-toolbar .close-editor-group,
.hc-black .monaco-workbench .part.editor > .content .editor-group-container > .editor-group-container-toolbar .close-editor-group {
background-image: url('close-big-inverse.svg');
}
/* Editor */
.monaco-workbench > .part.editor > .content .editor-group-container > .editor-container {
height: calc(100% - 35px); /* below title control */
}
.monaco-workbench > .part.editor > .content .editor-group-container.empty > .editor-container {
.monaco-workbench .part.editor > .content .editor-group-container.empty > .editor-container {
display: none;
}
.monaco-workbench > .part.editor > .content .editor-group-container > .editor-container > .editor-instance {
.monaco-workbench .part.editor > .content .editor-group-container > .editor-container > .editor-instance {
height: 100%;
}
.monaco-workbench > .part.editor > .content .grid-view-container {
.monaco-workbench .part.editor > .content .grid-view-container {
width: 100%;
height: 100%;
}

View File

@@ -22,7 +22,7 @@
cursor: default !important;
}
.monaco-shell .screen-reader-detected-explanation {
.monaco-workbench .screen-reader-detected-explanation {
width: 420px;
top: 30px;
right: 6px;
@@ -30,7 +30,7 @@
cursor: default;
}
.monaco-shell .screen-reader-detected-explanation .cancel {
.monaco-workbench .screen-reader-detected-explanation .cancel {
position: absolute;
top: 0;
right: 0;
@@ -41,27 +41,27 @@
cursor: pointer;
}
.monaco-shell .screen-reader-detected-explanation h2 {
.monaco-workbench .screen-reader-detected-explanation h2 {
margin: 0;
padding: 0;
font-weight: 400;
font-size: 1.8em;
}
.monaco-shell .screen-reader-detected-explanation p {
.monaco-workbench .screen-reader-detected-explanation p {
font-size: 1.2em;
}
.monaco-shell .screen-reader-detected-explanation hr {
.monaco-workbench .screen-reader-detected-explanation hr {
border: 0;
height: 2px;
}
.monaco-shell .screen-reader-detected-explanation .buttons {
.monaco-workbench .screen-reader-detected-explanation .buttons {
display: flex;
}
.monaco-shell .screen-reader-detected-explanation .buttons a {
.monaco-workbench .screen-reader-detected-explanation .buttons a {
font-size: 13px;
padding-left: 12px;
padding-right: 12px;
@@ -69,11 +69,11 @@
max-width: fit-content;
}
.monaco-shell.vs .screen-reader-detected-explanation .cancel {
.vs .monaco-workbench .screen-reader-detected-explanation .cancel {
background: url('close-statusview.svg') center center no-repeat;
}
.monaco-shell.vs-dark .screen-reader-detected-explanation .cancel,
.monaco-shell.hc-black .screen-reader-detected-explanation .cancel {
.vs-dark .monaco-workbench .screen-reader-detected-explanation .cancel,
.hc-black .monaco-workbench .screen-reader-detected-explanation .cancel {
background: url('close-statusview-inverse.svg') center center no-repeat;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 381 B

After

Width:  |  Height:  |  Size: 258 B

View File

@@ -5,7 +5,8 @@
/* Title Label */
.monaco-workbench > .part.editor > .content .editor-group-container > .title > .label-container {
.monaco-workbench .part.editor > .content .editor-group-container > .title > .label-container {
height: 35px;
display: flex;
justify-content: flex-start;
align-items: center;
@@ -13,7 +14,7 @@
flex: auto;
}
.monaco-workbench > .part.editor > .content .editor-group-container > .title .title-label {
.monaco-workbench .part.editor > .content .editor-group-container > .title .title-label {
line-height: 35px;
overflow: hidden;
text-overflow: ellipsis;
@@ -21,31 +22,31 @@
padding-left: 20px;
}
.monaco-workbench > .part.editor > .content .editor-group-container > .title.breadcrumbs .no-tabs.title-label {
.monaco-workbench .part.editor > .content .editor-group-container > .title.breadcrumbs .no-tabs.title-label {
flex: none;
}
.monaco-workbench > .part.editor > .content .editor-group-container > .title .monaco-icon-label::before {
.monaco-workbench .part.editor > .content .editor-group-container > .title .monaco-icon-label::before {
height: 35px; /* tweak the icon size of the editor labels when icons are enabled */
}
/* Breadcrumbs */
.monaco-workbench > .part.editor > .content .editor-group-container > .title.breadcrumbs .breadcrumbs-control {
.monaco-workbench .part.editor > .content .editor-group-container > .title.breadcrumbs .breadcrumbs-control {
flex: 1 50%;
overflow: hidden;
margin-left: .45em;
}
.monaco-workbench > .part.editor > .content .editor-group-container > .title.breadcrumbs .breadcrumbs-control .monaco-breadcrumb-item {
.monaco-workbench .part.editor > .content .editor-group-container > .title.breadcrumbs .breadcrumbs-control .monaco-breadcrumb-item {
font-size: 0.9em;
}
.monaco-workbench > .part.editor > .content .editor-group-container > .title.breadcrumbs .breadcrumbs-control.preview .monaco-breadcrumb-item {
.monaco-workbench .part.editor > .content .editor-group-container > .title.breadcrumbs .breadcrumbs-control.preview .monaco-breadcrumb-item {
font-style: italic;
}
.monaco-workbench > .part.editor > .content .editor-group-container > .title.breadcrumbs .breadcrumbs-control .monaco-breadcrumb-item::before {
.monaco-workbench .part.editor > .content .editor-group-container > .title.breadcrumbs .breadcrumbs-control .monaco-breadcrumb-item::before {
content: '/';
opacity: 1;
height: inherit;
@@ -54,35 +55,36 @@
}
/* {{SQL CARBON EDIT}} */
.monaco-workbench.windows > .part.editor > .content .editor-group-container > .title.breadcrumbs .breadcrumbs-control .monaco-breadcrumb-item::before {
.windows > .monaco-workbench .part.editor > .content .editor-group-container > .title.breadcrumbs .breadcrumbs-control .monaco-breadcrumb-item::before {
content: '/';
}
.monaco-workbench > .part.editor > .content .editor-group-container > .title.breadcrumbs .breadcrumbs-control .monaco-breadcrumb-item.root_folder::before,
.monaco-workbench > .part.editor > .content .editor-group-container > .title.breadcrumbs .breadcrumbs-control .monaco-breadcrumb-item.root_folder + .monaco-breadcrumb-item::before,
.monaco-workbench > .part.editor > .content .editor-group-container > .title.breadcrumbs .breadcrumbs-control.relative-path .monaco-breadcrumb-item:nth-child(2)::before {
.monaco-workbench .part.editor > .content .editor-group-container > .title.breadcrumbs .breadcrumbs-control .monaco-breadcrumb-item.root_folder::before,
.monaco-workbench .part.editor > .content .editor-group-container > .title.breadcrumbs .breadcrumbs-control .monaco-breadcrumb-item.root_folder + .monaco-breadcrumb-item::before,
.monaco-workbench .part.editor > .content .editor-group-container > .title.breadcrumbs .breadcrumbs-control.relative-path .monaco-breadcrumb-item:nth-child(2)::before,
.windows > .monaco-workbench .part.editor > .content .editor-group-container > .title.breadcrumbs .breadcrumbs-control .monaco-breadcrumb-item:nth-child(2)::before {
/* workspace folder, item following workspace folder, or relative path -> hide first seperator */
display: none;
}
.monaco-workbench > .part.editor > .content .editor-group-container > .title.breadcrumbs .breadcrumbs-control .monaco-breadcrumb-item.root_folder::after {
.monaco-workbench .part.editor > .content .editor-group-container > .title.breadcrumbs .breadcrumbs-control .monaco-breadcrumb-item.root_folder::after {
/* use dot separator for workspace folder */
content: '\00a0•\00a0';
padding: 0px;
padding: 0;
}
.monaco-workbench > .part.editor > .content .editor-group-container > .title.breadcrumbs .breadcrumbs-control .monaco-breadcrumb-item:last-child {
.monaco-workbench .part.editor > .content .editor-group-container > .title.breadcrumbs .breadcrumbs-control .monaco-breadcrumb-item:last-child {
padding-right: 4px; /* does not have trailing separator*/
}
/* Title Actions */
.monaco-workbench > .part.editor > .content .editor-group-container > .title .title-actions {
.monaco-workbench .part.editor > .content .editor-group-container > .title .title-actions {
display: flex;
flex: initial;
opacity: 0.5;
height: 35px;
}
.monaco-workbench > .part.editor > .content .editor-group-container.active > .title .title-actions {
.monaco-workbench .part.editor > .content .editor-group-container.active > .title .title-actions {
opacity: 1;
}

View File

@@ -5,37 +5,37 @@
/* Title Container */
.monaco-workbench > .part.editor > .content .editor-group-container > .title.tabs > .tabs-and-actions-container {
.monaco-workbench .part.editor > .content .editor-group-container > .title.tabs > .tabs-and-actions-container {
display: flex;
}
.monaco-workbench > .part.editor > .content .editor-group-container > .title.tabs > .tabs-and-actions-container > .monaco-scrollable-element {
.monaco-workbench .part.editor > .content .editor-group-container > .title.tabs > .tabs-and-actions-container > .monaco-scrollable-element {
flex: 1;
}
.monaco-workbench > .part.editor > .content .editor-group-container > .title.tabs > .tabs-and-actions-container > .monaco-scrollable-element .scrollbar {
.monaco-workbench .part.editor > .content .editor-group-container > .title.tabs > .tabs-and-actions-container > .monaco-scrollable-element .scrollbar {
z-index: 3; /* on top of tabs */
cursor: default;
}
/* Tabs Container */
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container {
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container {
display: flex;
height: 35px;
}
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container.scroll {
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container.scroll {
overflow: scroll !important;
}
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container::-webkit-scrollbar {
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container::-webkit-scrollbar {
display: none;
}
/* Tab */
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab {
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab {
position: relative;
display: flex;
white-space: nowrap;
@@ -45,45 +45,45 @@
padding-left: 10px;
}
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab.sizing-shrink.has-icon-theme.close-button-right,
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab.sizing-shrink.has-icon-theme.close-button-off {
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.sizing-shrink.has-icon-theme.close-button-right,
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.sizing-shrink.has-icon-theme.close-button-off {
padding-left: 5px; /* reduce padding when we show icons and are in shrinking mode and tab close button is not left */
}
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab.sizing-fit {
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.sizing-fit {
width: 120px;
min-width: fit-content;
}
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab.sizing-shrink {
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.sizing-shrink {
min-width: 60px;
flex-basis: 0; /* all tabs are even */
flex-grow: 1; /* all tabs grow even */
max-width: fit-content;
}
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab.sizing-shrink.close-button-left::after,
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab.sizing-shrink.close-button-off::after {
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.sizing-shrink.close-button-left::after,
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.sizing-shrink.close-button-off::after {
content: '';
display: flex;
flex: 0;
width: 5px; /* Reserve space to hide tab fade when close button is left or off (fixes https://github.com/Microsoft/vscode/issues/45728) */
}
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab.sizing-shrink.close-button-left {
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.sizing-shrink.close-button-left {
min-width: 80px; /* make more room for close button when it shows to the left */
padding-right: 5px; /* we need less room when sizing is shrink */
}
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab.dragged {
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.dragged {
will-change: transform; /* forces tab to be drawn on a separate layer (fixes https://github.com/Microsoft/vscode/issues/18733) */
}
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab.dragged-over div {
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.dragged-over div {
pointer-events: none; /* prevents cursor flickering (fixes https://github.com/Microsoft/vscode/issues/38753) */
}
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab.close-button-left {
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.close-button-left {
flex-direction: row-reverse;
padding-left: 0;
padding-right: 10px;
@@ -91,14 +91,14 @@
/* Tab border top/bottom */
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab > .tab-border-top-container,
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab > .tab-border-bottom-container {
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab > .tab-border-top-container,
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab > .tab-border-bottom-container {
display: none; /* hidden by default until a color is provided (see below) */
}
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab.active.tab-border-top > .tab-border-top-container,
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab.active.tab-border-bottom > .tab-border-bottom-container,
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab.dirty-border-top > .tab-border-top-container {
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.active.tab-border-top > .tab-border-top-container,
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.active.tab-border-bottom > .tab-border-bottom-container,
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.dirty-border-top > .tab-border-top-container {
display: block;
position: absolute;
left: 0;
@@ -107,19 +107,19 @@
width: 100%;
}
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab.active.tab-border-top > .tab-border-top-container {
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.active.tab-border-top > .tab-border-top-container {
top: 0;
height: 1px;
background-color: var(--tab-border-top-color);
}
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab.active.tab-border-bottom > .tab-border-bottom-container {
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.active.tab-border-bottom > .tab-border-bottom-container {
bottom: 0;
height: 1px;
background-color: var(--tab-border-bottom-color);
}
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab.dirty-border-top > .tab-border-top-container {
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.dirty-border-top > .tab-border-top-container {
top: 0;
height: 2px;
background-color: var(--tab-dirty-border-top-color);
@@ -127,16 +127,16 @@
/* Tab Label */
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab .tab-label {
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab .tab-label {
margin-top: auto;
margin-bottom: auto;
}
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab.sizing-shrink .tab-label {
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.sizing-shrink .tab-label {
position: relative;
}
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab.sizing-shrink > .tab-label::after {
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.sizing-shrink > .tab-label::after {
content: '';
position: absolute;
right: 0;
@@ -146,66 +146,66 @@
padding: 0;
}
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab.sizing-shrink:focus > .tab-label::after {
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.sizing-shrink:focus > .tab-label::after {
opacity: 0; /* when tab has the focus this shade breaks the tab border (fixes https://github.com/Microsoft/vscode/issues/57819) */
}
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab.sizing-fit .monaco-icon-label,
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab.sizing-fit .monaco-icon-label > .monaco-icon-label-description-container {
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.sizing-fit .monaco-icon-label,
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.sizing-fit .monaco-icon-label > .monaco-icon-label-description-container {
overflow: visible; /* fixes https://github.com/Microsoft/vscode/issues/20182 */
}
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab.sizing-shrink > .monaco-icon-label > .monaco-icon-label-description-container {
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.sizing-shrink > .monaco-icon-label > .monaco-icon-label-description-container {
text-overflow: clip;
}
.hc-black .monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab.sizing-shrink > .monaco-icon-label > .monaco-icon-label-description-container {
.hc-black .monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.sizing-shrink > .monaco-icon-label > .monaco-icon-label-description-container {
text-overflow: ellipsis;
}
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab .monaco-icon-label::before {
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab .monaco-icon-label::before {
height: 16px; /* tweak the icon size of the editor labels when icons are enabled */
}
/* Tab Close */
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab > .tab-close {
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab > .tab-close {
margin-top: auto;
margin-bottom: auto;
width: 28px;
}
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab.close-button-right.sizing-shrink > .tab-close {
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.close-button-right.sizing-shrink > .tab-close {
flex: 0;
overflow: hidden; /* let the close button be pushed out of view when sizing is set to shrink to make more room... */
}
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab.dirty.close-button-right.sizing-shrink > .tab-close,
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab.close-button-right.sizing-shrink:hover > .tab-close,
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab.close-button-right.sizing-shrink > .tab-close:focus-within {
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.dirty.close-button-right.sizing-shrink > .tab-close,
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.close-button-right.sizing-shrink:hover > .tab-close,
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.close-button-right.sizing-shrink > .tab-close:focus-within {
overflow: visible; /* ...but still show the close button on hover, focus and when dirty */
}
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab.close-button-off > .tab-close {
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.close-button-off > .tab-close {
display: none; /* hide the close action bar when we are configured to hide it */
}
.monaco-workbench > .part.editor > .content .editor-group-container.active > .title .tabs-container > .tab.active > .tab-close .action-label, /* always show it for active tab */
.monaco-workbench > .part.editor > .content .editor-group-container.active > .title .tabs-container > .tab > .tab-close .action-label:focus, /* always show it on focus */
.monaco-workbench > .part.editor > .content .editor-group-container.active > .title .tabs-container > .tab:hover > .tab-close .action-label, /* always show it on hover */
.monaco-workbench > .part.editor > .content .editor-group-container.active > .title .tabs-container > .tab.active:hover > .tab-close .action-label, /* always show it on hover */
.monaco-workbench > .part.editor > .content .editor-group-container.active > .title .tabs-container > .tab.dirty > .tab-close .action-label { /* always show it for dirty tabs */
.monaco-workbench .part.editor > .content .editor-group-container.active > .title .tabs-container > .tab.active > .tab-close .action-label, /* always show it for active tab */
.monaco-workbench .part.editor > .content .editor-group-container.active > .title .tabs-container > .tab > .tab-close .action-label:focus, /* always show it on focus */
.monaco-workbench .part.editor > .content .editor-group-container.active > .title .tabs-container > .tab:hover > .tab-close .action-label, /* always show it on hover */
.monaco-workbench .part.editor > .content .editor-group-container.active > .title .tabs-container > .tab.active:hover > .tab-close .action-label, /* always show it on hover */
.monaco-workbench .part.editor > .content .editor-group-container.active > .title .tabs-container > .tab.dirty > .tab-close .action-label { /* always show it for dirty tabs */
opacity: 1;
}
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab.active > .tab-close .action-label, /* show dimmed for inactive group */
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab.active:hover > .tab-close .action-label, /* show dimmed for inactive group */
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab.dirty > .tab-close .action-label, /* show dimmed for inactive group */
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab:hover > .tab-close .action-label { /* show dimmed for inactive group */
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.active > .tab-close .action-label, /* show dimmed for inactive group */
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.active:hover > .tab-close .action-label, /* show dimmed for inactive group */
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.dirty > .tab-close .action-label, /* show dimmed for inactive group */
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab:hover > .tab-close .action-label { /* show dimmed for inactive group */
opacity: 0.5;
}
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab > .tab-close .action-label {
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab > .tab-close .action-label {
opacity: 0;
display: block;
height: 16px;
@@ -216,53 +216,53 @@
margin-right: 0.5em;
}
.vs .monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab.dirty .close-editor-action {
.vs .monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.dirty .close-editor-action {
background: url('close-dirty.svg') center center no-repeat;
}
.vs-dark .monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab.dirty .close-editor-action,
.hc-black .monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab.dirty .close-editor-action {
.vs-dark .monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.dirty .close-editor-action,
.hc-black .monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.dirty .close-editor-action {
background: url('close-dirty-inverse.svg') center center no-repeat;
}
.vs .monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab.dirty .close-editor-action:hover {
.vs .monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.dirty .close-editor-action:hover {
background: url('close.svg') center center no-repeat;
}
.vs-dark .monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab.dirty .close-editor-action:hover,
.hc-black .monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab.dirty .close-editor-action:hover {
.vs-dark .monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.dirty .close-editor-action:hover,
.hc-black .monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.dirty .close-editor-action:hover {
background: url('close-inverse.svg') center center no-repeat;
}
/* No Tab Close Button */
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab.close-button-off {
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.close-button-off {
padding-right: 10px; /* give a little bit more room if close button is off */
}
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab.sizing-shrink.close-button-off {
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.sizing-shrink.close-button-off {
padding-right: 5px; /* we need less room when sizing is shrink */
}
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab.close-button-off.dirty {
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.close-button-off.dirty:not(.dirty-border-top) {
background-repeat: no-repeat;
background-position-y: center;
background-position-x: calc(100% - 6px); /* to the right of the tab label */
padding-right: 28px; /* make room for dirty indication when we are running without close button */
}
.vs .monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab.close-button-off.dirty {
.vs .monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.close-button-off.dirty:not(.dirty-border-top) {
background-image: url('close-dirty.svg');
}
.vs-dark .monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab.close-button-off.dirty,
.hc-black .monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab.close-button-off.dirty {
.vs-dark .monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.close-button-off.dirty:not(.dirty-border-top),
.hc-black .monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.close-button-off.dirty {
background-image: url('close-dirty-inverse.svg');
}
/* Editor Actions */
.monaco-workbench > .part.editor > .content .editor-group-container > .title .editor-actions {
.monaco-workbench .part.editor > .content .editor-group-container > .title .editor-actions {
cursor: default;
flex: initial;
padding-left: 4px;
@@ -271,30 +271,30 @@
/* Breadcrumbs */
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-breadcrumbs .breadcrumbs-control {
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-breadcrumbs .breadcrumbs-control {
flex: 1 100%;
height: 22px;
cursor: default;
}
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-breadcrumbs .breadcrumbs-control .monaco-icon-label {
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-breadcrumbs .breadcrumbs-control .monaco-icon-label {
height: 22px;
line-height: 22px;
}
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-breadcrumbs .breadcrumbs-control .monaco-icon-label::before {
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-breadcrumbs .breadcrumbs-control .monaco-icon-label::before {
height: 22px; /* tweak the icon size of the editor labels when icons are enabled */
}
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-breadcrumbs .breadcrumbs-control .monaco-breadcrumb-item {
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-breadcrumbs .breadcrumbs-control .monaco-breadcrumb-item {
max-width: 80%;
}
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-breadcrumbs .breadcrumbs-control .monaco-breadcrumb-item::before {
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-breadcrumbs .breadcrumbs-control .monaco-breadcrumb-item::before {
min-width: 16px;
height: 22px;
}
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-breadcrumbs .breadcrumbs-control .monaco-breadcrumb-item:last-child {
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-breadcrumbs .breadcrumbs-control .monaco-breadcrumb-item:last-child {
padding-right: 8px;
}

View File

@@ -5,31 +5,31 @@
/* Editor Label */
.monaco-workbench > .part.editor > .content .editor-group-container > .title .title-label,
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab .tab-label {
.monaco-workbench .part.editor > .content .editor-group-container > .title .title-label,
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab .tab-label {
white-space: nowrap;
flex: 1;
}
.monaco-workbench > .part.editor > .content .editor-group-container > .title .title-label a,
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab .tab-label a {
.monaco-workbench .part.editor > .content .editor-group-container > .title .title-label a,
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab .tab-label a {
text-decoration: none;
font-size: 13px;
}
.monaco-workbench > .part.editor > .content .editor-group-container > .title .monaco-icon-label::before,
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab .monaco-icon-label::before,
.monaco-workbench > .part.editor > .content .editor-group-container > .title .title-label a,
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab .tab-label a,
.monaco-workbench > .part.editor > .content .editor-group-container > .title .title-label h2,
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab .tab-label span {
.monaco-workbench .part.editor > .content .editor-group-container > .title .monaco-icon-label::before,
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab .monaco-icon-label::before,
.monaco-workbench .part.editor > .content .editor-group-container > .title .title-label a,
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab .tab-label a,
.monaco-workbench .part.editor > .content .editor-group-container > .title .title-label h2,
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab .tab-label span {
cursor: pointer;
}
/* Title Actions */
.monaco-workbench > .part.editor > .content .editor-group-container > .title .title-actions .action-label,
.monaco-workbench > .part.editor > .content .editor-group-container > .title .editor-actions .action-label {
.monaco-workbench .part.editor > .content .editor-group-container > .title .title-actions .action-label,
.monaco-workbench .part.editor > .content .editor-group-container > .title .editor-actions .action-label {
display: block;
height: 35px;
line-height: 35px;
@@ -39,29 +39,29 @@
background-repeat: no-repeat;
}
.hc-black .monaco-workbench > .part.editor > .content .editor-group-container > .title .title-actions .action-label,
.hc-black .monaco-workbench > .part.editor > .content .editor-group-container > .title .editor-actions .action-label {
.hc-black .monaco-workbench .part.editor > .content .editor-group-container > .title .title-actions .action-label,
.hc-black .monaco-workbench .part.editor > .content .editor-group-container > .title .editor-actions .action-label {
line-height: initial;
}
.monaco-workbench > .part.editor > .content .editor-group-container > .title .editor-actions .action-label .label,
.monaco-workbench > .part.editor > .content .editor-group-container > .title .title-actions .action-label .label {
.monaco-workbench .part.editor > .content .editor-group-container > .title .editor-actions .action-label .label,
.monaco-workbench .part.editor > .content .editor-group-container > .title .title-actions .action-label .label {
display: none;
}
/* Drag Cursor */
.monaco-workbench > .part.editor > .content .editor-group-container > .title {
.monaco-workbench .part.editor > .content .editor-group-container > .title {
cursor: -webkit-grab;
}
/* Actions */
.monaco-workbench > .part.editor > .content .editor-group-container > .title .close-editor-action {
.monaco-workbench .part.editor > .content .editor-group-container > .title .close-editor-action {
background: url('close.svg') center center no-repeat;
}
.vs-dark .monaco-workbench > .part.editor > .content .editor-group-container > .title .close-editor-action,
.hc-black .monaco-workbench > .part.editor > .content .editor-group-container > .title .close-editor-action {
.vs-dark .monaco-workbench .part.editor > .content .editor-group-container > .title .close-editor-action,
.hc-black .monaco-workbench .part.editor > .content .editor-group-container > .title .close-editor-action {
background: url('close-inverse.svg') center center no-repeat;
}

View File

@@ -6,7 +6,7 @@
import 'vs/css!./media/notabstitlecontrol';
import { toResource, Verbosity, IEditorInput } from 'vs/workbench/common/editor';
import { TitleControl, IToolbarActions } from 'vs/workbench/browser/parts/editor/titleControl';
import { ResourceLabel } from 'vs/workbench/browser/labels';
import { ResourceLabel, IResourceLabel } from 'vs/workbench/browser/labels';
import { TAB_ACTIVE_FOREGROUND, TAB_UNFOCUSED_ACTIVE_FOREGROUND } from 'vs/workbench/common/theme';
import { EventType as TouchEventType, GestureEvent, Gesture } from 'vs/base/browser/touch';
import { addDisposableListener, EventType, addClass, EventHelper, removeClass, toggleClass } from 'vs/base/browser/dom';
@@ -22,7 +22,7 @@ interface IRenderedEditorLabel {
export class NoTabsTitleControl extends TitleControl {
private titleContainer: HTMLElement;
private editorLabel: ResourceLabel;
private editorLabel: IResourceLabel;
private activeLabel: IRenderedEditorLabel = Object.create(null);
protected create(parent: HTMLElement): void {
@@ -40,8 +40,8 @@ export class NoTabsTitleControl extends TitleControl {
this.titleContainer.appendChild(labelContainer);
// Editor Label
this.editorLabel = this._register(this.instantiationService.createInstance(ResourceLabel, labelContainer, void 0));
this._register(this.editorLabel.onClick(e => this.onTitleLabelClick(e)));
this.editorLabel = this._register(this.instantiationService.createInstance(ResourceLabel, labelContainer, undefined)).element;
this._register(addDisposableListener(this.editorLabel.element, EventType.CLICK, e => this.onTitleLabelClick(e)));
// Breadcrumbs
this.createBreadcrumbsControl(labelContainer, { showFileIcons: false, showSymbolIcons: true, showDecorationColors: false, breadcrumbsBackground: () => Color.transparent });
@@ -244,7 +244,7 @@ export class NoTabsTitleControl extends TitleControl {
title = ''; // dont repeat what is already shown
}
this.editorLabel.setLabel({ name, description, resource }, { title, italic: !isEditorPinned, extraClasses: ['no-tabs', 'title-label'] });
this.editorLabel.setResource({ name, description, resource }, { title, italic: !isEditorPinned, extraClasses: ['no-tabs', 'title-label'] });
if (isGroupActive) {
this.editorLabel.element.style.color = this.getColor(TAB_ACTIVE_FOREGROUND);
} else {

View File

@@ -28,7 +28,7 @@ export class RangeHighlightDecorations extends Disposable {
private readonly _onHighlightRemoved: Emitter<void> = this._register(new Emitter<void>());
get onHighlghtRemoved(): Event<void> { return this._onHighlightRemoved.event; }
constructor(@IEditorService private editorService: IEditorService) {
constructor(@IEditorService private readonly editorService: IEditorService) {
super();
}
@@ -58,7 +58,7 @@ export class RangeHighlightDecorations extends Disposable {
this.setEditor(editor);
}
private getEditor(resourceRange: IRangeHighlightDecoration): ICodeEditor {
private getEditor(resourceRange: IRangeHighlightDecoration): ICodeEditor | undefined {
const activeEditor = this.editorService.activeEditor;
const resource = activeEditor && activeEditor.getResource();
if (resource) {
@@ -67,7 +67,7 @@ export class RangeHighlightDecorations extends Disposable {
}
}
return null;
return undefined;
}
private setEditor(editor: ICodeEditor) {

View File

@@ -13,12 +13,10 @@ import { LRUCache } from 'vs/base/common/map';
import { Schemas } from 'vs/base/common/network';
import { clamp } from 'vs/base/common/numbers';
import { Themable } from 'vs/workbench/common/theme';
import { IStatusbarItem, StatusbarItemDescriptor, IStatusbarRegistry, Extensions } from 'vs/workbench/browser/parts/statusbar/statusbar';
import { StatusbarAlignment } from 'vs/platform/statusbar/common/statusbar';
import { IStatusbarItem } from 'vs/workbench/browser/parts/statusbar/statusbar';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { IDisposable, Disposable, combinedDisposable } from 'vs/base/common/lifecycle';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { Registry } from 'vs/platform/registry/common/platform';
import { Action } from 'vs/base/common/actions';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { memoize } from 'vs/base/common/decorators';
@@ -234,7 +232,7 @@ class FileSeemsBinaryFileView {
type Scale = number | 'fit';
class ZoomStatusbarItem extends Themable implements IStatusbarItem {
export class ZoomStatusbarItem extends Themable implements IStatusbarItem {
static instance: ZoomStatusbarItem;
@@ -244,7 +242,7 @@ class ZoomStatusbarItem extends Themable implements IStatusbarItem {
private onSelectScale?: (scale: Scale) => void;
constructor(
@IContextMenuService private contextMenuService: IContextMenuService,
@IContextMenuService private readonly contextMenuService: IContextMenuService,
@IEditorService editorService: IEditorService,
@IThemeService themeService: IThemeService
) {
@@ -257,7 +255,7 @@ class ZoomStatusbarItem extends Themable implements IStatusbarItem {
private onActiveEditorChanged(): void {
this.hide();
this.onSelectScale = void 0;
this.onSelectScale = undefined;
}
show(scale: Scale, onSelectScale: (scale: number) => void) {
@@ -298,12 +296,12 @@ class ZoomStatusbarItem extends Themable implements IStatusbarItem {
private get zoomActions(): Action[] {
const scales: Scale[] = [10, 5, 2, 1, 0.5, 0.2, 'fit'];
return scales.map(scale =>
new Action(`zoom.${scale}`, ZoomStatusbarItem.zoomLabel(scale), void 0, void 0, () => {
new Action(`zoom.${scale}`, ZoomStatusbarItem.zoomLabel(scale), undefined, undefined, () => {
if (this.onSelectScale) {
this.onSelectScale(scale);
}
return void 0;
return Promise.resolve(undefined);
}));
}
@@ -314,10 +312,6 @@ class ZoomStatusbarItem extends Themable implements IStatusbarItem {
}
}
Registry.as<IStatusbarRegistry>(Extensions.Statusbar).registerStatusbarItem(
new StatusbarItemDescriptor(ZoomStatusbarItem, StatusbarAlignment.RIGHT, 101 /* to the left of editor status (100) */)
);
interface ImageState {
scale: Scale;
offsetX: number;
@@ -394,7 +388,7 @@ class InlineImageView {
DOM.removeClass(image, 'pixelated');
image.style.minWidth = 'auto';
image.style.width = 'auto';
InlineImageView.imageStateCache.set(cacheKey, null);
InlineImageView.imageStateCache.delete(cacheKey);
} else {
const oldWidth = image.width;
const oldHeight = image.height;
@@ -432,6 +426,10 @@ class InlineImageView {
}
function firstZoom() {
if (!image) {
return;
}
scale = image.clientWidth / image.naturalWidth;
updateScale(scale);
}
@@ -537,10 +535,13 @@ class InlineImageView {
DOM.clearNode(container);
DOM.addClasses(container, 'image', 'zoom-in');
image = DOM.append(container, DOM.$('img.scale-to-fit'));
image = DOM.append(container, DOM.$<HTMLImageElement>('img.scale-to-fit'));
image.style.visibility = 'hidden';
disposables.push(DOM.addDisposableListener(image, DOM.EventType.LOAD, e => {
if (!image) {
return;
}
if (typeof descriptor.size === 'number') {
metadataClb(nls.localize('imgMeta', '{0}x{1} {2}', image.naturalWidth, image.naturalHeight, BinarySize.formatSize(descriptor.size)));
} else {
@@ -568,7 +569,7 @@ class InlineImageView {
return context;
}
private static imageSrc(descriptor: IResourceDescriptor, fileService: IFileService): Thenable<string> {
private static imageSrc(descriptor: IResourceDescriptor, fileService: IFileService): Promise<string> {
if (descriptor.resource.scheme === Schemas.data) {
return Promise.resolve(descriptor.resource.toString(true /* skip encoding */));
}
@@ -582,7 +583,7 @@ class InlineImageView {
}
function getMime(descriptor: IResourceDescriptor) {
let mime = descriptor.mime;
let mime: string | undefined = descriptor.mime;
if (!mime && descriptor.resource.scheme !== Schemas.data) {
mime = mimes.getMediaMime(descriptor.resource.path);
}

View File

@@ -15,7 +15,7 @@ import { IEditorRegistry, Extensions as EditorExtensions } from 'vs/workbench/br
import { CancellationToken } from 'vs/base/common/cancellation';
import { IEditorGroup } from 'vs/workbench/services/group/common/editorGroupsService';
import { SplitView, Sizing, Orientation } from 'vs/base/browser/ui/splitview/splitview';
import { Event, Relay, anyEvent, mapEvent, Emitter } from 'vs/base/common/event';
import { Event, Relay, Emitter } from 'vs/base/common/event';
import { IStorageService } from 'vs/platform/storage/common/storage';
export class SideBySideEditor extends BaseEditor {
@@ -43,8 +43,8 @@ export class SideBySideEditor extends BaseEditor {
get minimumHeight() { return this.minimumMasterHeight + this.minimumDetailsHeight; }
get maximumHeight() { return this.maximumMasterHeight + this.maximumDetailsHeight; }
protected masterEditor: BaseEditor;
protected detailsEditor: BaseEditor;
protected masterEditor?: BaseEditor;
protected detailsEditor?: BaseEditor;
private masterEditorContainer: HTMLElement;
private detailsEditorContainer: HTMLElement;
@@ -52,13 +52,13 @@ export class SideBySideEditor extends BaseEditor {
private splitview: SplitView;
private dimension: DOM.Dimension = new DOM.Dimension(0, 0);
private onDidCreateEditors = this._register(new Emitter<{ width: number; height: number; }>());
private _onDidSizeConstraintsChange = this._register(new Relay<{ width: number; height: number; }>());
readonly onDidSizeConstraintsChange: Event<{ width: number; height: number; }> = anyEvent(this.onDidCreateEditors.event, this._onDidSizeConstraintsChange.event);
private onDidCreateEditors = this._register(new Emitter<{ width: number; height: number; } | undefined>());
private _onDidSizeConstraintsChange = this._register(new Relay<{ width: number; height: number; } | undefined>());
readonly onDidSizeConstraintsChange: Event<{ width: number; height: number; } | undefined> = Event.any(this.onDidCreateEditors.event, this._onDidSizeConstraintsChange.event);
constructor(
@ITelemetryService telemetryService: ITelemetryService,
@IInstantiationService private instantiationService: IInstantiationService,
@IInstantiationService private readonly instantiationService: IInstantiationService,
@IThemeService themeService: IThemeService,
@IStorageService storageService: IStorageService
) {
@@ -92,7 +92,7 @@ export class SideBySideEditor extends BaseEditor {
this.updateStyles();
}
setInput(newInput: SideBySideEditorInput, options: EditorOptions, token: CancellationToken): Thenable<void> {
setInput(newInput: SideBySideEditorInput, options: EditorOptions, token: CancellationToken): Promise<void> {
const oldInput = <SideBySideEditorInput>this.input;
return super.setInput(newInput, options, token)
.then(() => this.updateInput(oldInput, newInput, options, token));
@@ -141,7 +141,7 @@ export class SideBySideEditor extends BaseEditor {
this.splitview.layout(dimension.width);
}
getControl(): IEditorControl {
getControl(): IEditorControl | null {
if (this.masterEditor) {
return this.masterEditor.getControl();
}
@@ -149,15 +149,15 @@ export class SideBySideEditor extends BaseEditor {
return null;
}
getMasterEditor(): IEditor {
getMasterEditor(): IEditor | undefined {
return this.masterEditor;
}
getDetailsEditor(): IEditor {
getDetailsEditor(): IEditor | undefined {
return this.detailsEditor;
}
private updateInput(oldInput: SideBySideEditorInput, newInput: SideBySideEditorInput, options: EditorOptions, token: CancellationToken): Thenable<void> {
private updateInput(oldInput: SideBySideEditorInput, newInput: SideBySideEditorInput, options: EditorOptions, token: CancellationToken): Promise<void> {
if (!newInput.matches(oldInput)) {
if (oldInput) {
this.disposeEditors();
@@ -165,22 +165,28 @@ export class SideBySideEditor extends BaseEditor {
return this.setNewInput(newInput, options, token);
}
if (!this.detailsEditor || !this.masterEditor) {
return Promise.resolve();
}
return Promise.all([
this.detailsEditor.setInput(newInput.details, null, token),
this.masterEditor.setInput(newInput.master, options, token)]
).then(() => void 0);
).then(() => undefined);
}
private setNewInput(newInput: SideBySideEditorInput, options: EditorOptions, token: CancellationToken): Thenable<void> {
const detailsEditor = this._createEditor(<EditorInput>newInput.details, this.detailsEditorContainer);
const masterEditor = this._createEditor(<EditorInput>newInput.master, this.masterEditorContainer);
private setNewInput(newInput: SideBySideEditorInput, options: EditorOptions, token: CancellationToken): Promise<void> {
const detailsEditor = this.doCreateEditor(<EditorInput>newInput.details, this.detailsEditorContainer);
const masterEditor = this.doCreateEditor(<EditorInput>newInput.master, this.masterEditorContainer);
return this.onEditorsCreated(detailsEditor, masterEditor, newInput.details, newInput.master, options, token);
}
private _createEditor(editorInput: EditorInput, container: HTMLElement): BaseEditor {
private doCreateEditor(editorInput: EditorInput, container: HTMLElement): BaseEditor {
const descriptor = Registry.as<IEditorRegistry>(EditorExtensions.Editors).getEditor(editorInput);
if (!descriptor) {
throw new Error('No descriptor for editor found');
}
const editor = descriptor.instantiate(this.instantiationService);
editor.create(container);
@@ -193,12 +199,12 @@ export class SideBySideEditor extends BaseEditor {
this.detailsEditor = details;
this.masterEditor = master;
this._onDidSizeConstraintsChange.input = anyEvent(
mapEvent(details.onDidSizeConstraintsChange, () => undefined),
mapEvent(master.onDidSizeConstraintsChange, () => undefined)
this._onDidSizeConstraintsChange.input = Event.any(
Event.map(details.onDidSizeConstraintsChange, () => undefined),
Event.map(master.onDidSizeConstraintsChange, () => undefined)
);
this.onDidCreateEditors.fire();
this.onDidCreateEditors.fire(undefined);
return Promise.all([this.detailsEditor.setInput(detailsInput, null, token), this.masterEditor.setInput(masterInput, options, token)]).then(() => this.focus());
}
@@ -214,12 +220,12 @@ export class SideBySideEditor extends BaseEditor {
private disposeEditors(): void {
if (this.detailsEditor) {
this.detailsEditor.dispose();
this.detailsEditor = null;
this.detailsEditor = undefined;
}
if (this.masterEditor) {
this.masterEditor.dispose();
this.masterEditor = null;
this.masterEditor = undefined;
}
this.detailsEditorContainer.innerHTML = '';

View File

@@ -10,7 +10,7 @@ import { toResource, GroupIdentifier, IEditorInput, Verbosity, EditorCommandsCon
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { EventType as TouchEventType, GestureEvent, Gesture } from 'vs/base/browser/touch';
import { KeyCode } from 'vs/base/common/keyCodes';
import { ResourceLabel } from 'vs/workbench/browser/labels';
import { ResourceLabels, IResourceLabel, DEFAULT_LABELS_CONTAINER } from 'vs/workbench/browser/labels';
import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
@@ -69,7 +69,7 @@ export class TabsTitleControl extends TitleControl {
private tabsScrollbar: ScrollableElement;
private closeOneEditorAction: CloseOneEditorAction;
private tabLabelWidgets: ResourceLabel[] = [];
private tabResourceLabels: ResourceLabels;
private tabLabels: IEditorInputLabel[] = [];
private tabDisposeables: IDisposable[] = [];
@@ -83,7 +83,7 @@ export class TabsTitleControl extends TitleControl {
group: IEditorGroupView,
@IContextMenuService contextMenuService: IContextMenuService,
@IInstantiationService instantiationService: IInstantiationService,
@IUntitledEditorService private untitledEditorService: IUntitledEditorService,
@IUntitledEditorService private readonly untitledEditorService: IUntitledEditorService,
@IContextKeyService contextKeyService: IContextKeyService,
@IKeybindingService keybindingService: IKeybindingService,
@ITelemetryService telemetryService: ITelemetryService,
@@ -142,6 +142,9 @@ export class TabsTitleControl extends TitleControl {
addClass(breadcrumbsContainer, 'tabs-breadcrumbs');
this.titleContainer.appendChild(breadcrumbsContainer);
this.createBreadcrumbsControl(breadcrumbsContainer, { showFileIcons: true, showSymbolIcons: true, showDecorationColors: false, breadcrumbsBackground: breadcrumbsBackground });
// Tab Labels
this.tabResourceLabels = this._register(this.instantiationService.createInstance(ResourceLabels, DEFAULT_LABELS_CONTAINER));
}
private createTabsScrollbar(scrollable: HTMLElement): ScrollableElement {
@@ -314,7 +317,6 @@ export class TabsTitleControl extends TitleControl {
(this.tabsContainer.lastChild as HTMLElement).remove();
// Remove associated tab label and widget
this.tabLabelWidgets.pop();
this.tabDisposeables.pop().dispose();
}
@@ -330,7 +332,7 @@ export class TabsTitleControl extends TitleControl {
clearNode(this.tabsContainer);
this.tabDisposeables = dispose(this.tabDisposeables);
this.tabLabelWidgets = [];
this.tabResourceLabels.clear();
this.tabLabels = [];
this.clearEditorActionsToolbar();
@@ -414,12 +416,12 @@ export class TabsTitleControl extends TitleControl {
this.redraw();
}
private withTab(editor: IEditorInput, fn: (tabContainer: HTMLElement, tabLabelWidget: ResourceLabel, tabLabel: IEditorInputLabel) => void): void {
private withTab(editor: IEditorInput, fn: (tabContainer: HTMLElement, tabLabelWidget: IResourceLabel, tabLabel: IEditorInputLabel) => void): void {
const editorIndex = this.group.getIndexOfEditor(editor);
const tabContainer = this.tabsContainer.children[editorIndex] as HTMLElement;
if (tabContainer) {
fn(tabContainer, this.tabLabelWidgets[editorIndex], this.tabLabels[editorIndex]);
fn(tabContainer, this.tabResourceLabels.get(editorIndex), this.tabLabels[editorIndex]);
}
}
@@ -441,8 +443,7 @@ export class TabsTitleControl extends TitleControl {
tabContainer.appendChild(tabBorderTopContainer);
// Tab Editor Label
const editorLabel = this.instantiationService.createInstance(ResourceLabel, tabContainer, void 0);
this.tabLabelWidgets.push(editorLabel);
const editorLabel = this.tabResourceLabels.create(tabContainer);
// Tab Close Button
const tabCloseContainer = document.createElement('div');
@@ -479,7 +480,7 @@ export class TabsTitleControl extends TitleControl {
e.preventDefault(); // required to prevent auto-scrolling (https://github.com/Microsoft/vscode/issues/16690)
}
return void 0; // only for left mouse click
return undefined; // only for left mouse click
}
if (this.originatesFromTabActionBar(e)) {
@@ -489,7 +490,7 @@ export class TabsTitleControl extends TitleControl {
// Open tabs editor
this.group.openEditor(this.group.getEditor(index));
return void 0;
return undefined;
};
const showContextMenu = (e: Event) => {
@@ -836,16 +837,16 @@ export class TabsTitleControl extends TitleControl {
this.layout(this.dimension);
}
private forEachTab(fn: (editor: IEditorInput, index: number, tabContainer: HTMLElement, tabLabelWidget: ResourceLabel, tabLabel: IEditorInputLabel) => void): void {
private forEachTab(fn: (editor: IEditorInput, index: number, tabContainer: HTMLElement, tabLabelWidget: IResourceLabel, tabLabel: IEditorInputLabel) => void): void {
this.group.editors.forEach((editor, index) => {
const tabContainer = this.tabsContainer.children[index] as HTMLElement;
if (tabContainer) {
fn(editor, index, tabContainer, this.tabLabelWidgets[index], this.tabLabels[index]);
fn(editor, index, tabContainer, this.tabResourceLabels.get(index), this.tabLabels[index]);
}
});
}
private redrawTab(editor: IEditorInput, index: number, tabContainer: HTMLElement, tabLabelWidget: ResourceLabel, tabLabel: IEditorInputLabel): void {
private redrawTab(editor: IEditorInput, index: number, tabContainer: HTMLElement, tabLabelWidget: IResourceLabel, tabLabel: IEditorInputLabel): void {
// Label
this.redrawLabel(editor, tabContainer, tabLabelWidget, tabLabel);
@@ -880,7 +881,7 @@ export class TabsTitleControl extends TitleControl {
this.setEditorTabColor(editor, tabContainer, this.group.isActive(editor));
}
private redrawLabel(editor: IEditorInput, tabContainer: HTMLElement, tabLabelWidget: ResourceLabel, tabLabel: IEditorInputLabel): void {
private redrawLabel(editor: IEditorInput, tabContainer: HTMLElement, tabLabelWidget: IResourceLabel, tabLabel: IEditorInputLabel): void {
const name = tabLabel.name;
const description = tabLabel.description || '';
const title = tabLabel.title || '';
@@ -890,14 +891,14 @@ export class TabsTitleControl extends TitleControl {
tabContainer.title = title;
// Label
tabLabelWidget.setLabel({ name, description, resource: toResource(editor, { supportSideBySide: true }) }, { title, extraClasses: ['tab-label'], italic: !this.group.isPinned(editor) });
tabLabelWidget.setResource({ name, description, resource: toResource(editor, { supportSideBySide: true }) }, { title, extraClasses: ['tab-label'], italic: !this.group.isPinned(editor) });
// {{SQL CARBON EDIT}} -- Display the editor's tab color
const isTabActive = this.group.isActive(editor);
this.setEditorTabColor(editor, tabContainer, isTabActive);
}
private redrawEditorActiveAndDirty(isGroupActive: boolean, editor: IEditorInput, tabContainer: HTMLElement, tabLabelWidget: ResourceLabel): void {
private redrawEditorActiveAndDirty(isGroupActive: boolean, editor: IEditorInput, tabContainer: HTMLElement, tabLabelWidget: IResourceLabel): void {
const isTabActive = this.group.isActive(editor);
const hasModifiedBorderTop = this.doRedrawEditorDirty(isGroupActive, isTabActive, editor, tabContainer);
@@ -905,7 +906,7 @@ export class TabsTitleControl extends TitleControl {
this.doRedrawEditorActive(isGroupActive, !hasModifiedBorderTop, editor, tabContainer, tabLabelWidget);
}
private doRedrawEditorActive(isGroupActive: boolean, allowBorderTop: boolean, editor: IEditorInput, tabContainer: HTMLElement, tabLabelWidget: ResourceLabel): void {
private doRedrawEditorActive(isGroupActive: boolean, allowBorderTop: boolean, editor: IEditorInput, tabContainer: HTMLElement, tabLabelWidget: IResourceLabel): void {
// Tab is active
if (this.group.isActive(editor)) {
@@ -924,7 +925,7 @@ export class TabsTitleControl extends TitleControl {
tabContainer.style.removeProperty('--tab-border-bottom-color');
}
const activeTabBorderColorTop = allowBorderTop ? this.getColor(isGroupActive ? TAB_ACTIVE_BORDER_TOP : TAB_UNFOCUSED_ACTIVE_BORDER_TOP) : void 0;
const activeTabBorderColorTop = allowBorderTop ? this.getColor(isGroupActive ? TAB_ACTIVE_BORDER_TOP : TAB_UNFOCUSED_ACTIVE_BORDER_TOP) : undefined;
if (activeTabBorderColorTop) {
addClass(tabContainer, 'tab-border-top');
tabContainer.style.setProperty('--tab-border-top-color', activeTabBorderColorTop.toString());
@@ -1008,7 +1009,7 @@ export class TabsTitleControl extends TitleControl {
if (!this.layoutScheduled) {
this.layoutScheduled = scheduleAtNextAnimationFrame(() => {
this.doLayout(this.dimension);
this.layoutScheduled = void 0;
this.layoutScheduled = undefined;
});
}
}
@@ -1073,7 +1074,7 @@ export class TabsTitleControl extends TitleControl {
return this.tabsContainer.children[editorIndex] as HTMLElement;
}
return void 0;
return undefined;
}
private blockRevealActiveTabOnce(): void {
@@ -1094,7 +1095,7 @@ export class TabsTitleControl extends TitleControl {
element = (e as GestureEvent).initialTarget as HTMLElement;
}
return !!findParentWithClass(element, 'monaco-action-bar', 'tab');
return !!findParentWithClass(element, 'action-item', 'tab');
}
private onDrop(e: DragEvent, targetIndex: number): void {
@@ -1185,21 +1186,21 @@ registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => {
const activeContrastBorderColor = theme.getColor(activeContrastBorder);
if (activeContrastBorderColor) {
collector.addRule(`
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab.active,
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab.active:hover {
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.active,
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.active:hover {
outline: 1px solid;
outline-offset: -5px;
}
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab:hover {
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab:hover {
outline: 1px dashed;
outline-offset: -5px;
}
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab.active > .tab-close .action-label,
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab.active:hover > .tab-close .action-label,
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab.dirty > .tab-close .action-label,
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab:hover > .tab-close .action-label {
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.active > .tab-close .action-label,
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.active:hover > .tab-close .action-label,
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.dirty > .tab-close .action-label,
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab:hover > .tab-close .action-label {
opacity: 1 !important;
}
`);
@@ -1209,7 +1210,7 @@ registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => {
const tabHoverBackground = theme.getColor(TAB_HOVER_BACKGROUND);
if (tabHoverBackground) {
collector.addRule(`
.monaco-workbench > .part.editor > .content .editor-group-container.active > .title .tabs-container > .tab:hover {
.monaco-workbench .part.editor > .content .editor-group-container.active > .title .tabs-container > .tab:hover {
background-color: ${tabHoverBackground} !important;
}
`);
@@ -1218,7 +1219,7 @@ registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => {
const tabUnfocusedHoverBackground = theme.getColor(TAB_UNFOCUSED_HOVER_BACKGROUND);
if (tabUnfocusedHoverBackground) {
collector.addRule(`
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab:hover {
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab:hover {
background-color: ${tabUnfocusedHoverBackground} !important;
}
`);
@@ -1228,7 +1229,7 @@ registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => {
const tabHoverBorder = theme.getColor(TAB_HOVER_BORDER);
if (tabHoverBorder) {
collector.addRule(`
.monaco-workbench > .part.editor > .content .editor-group-container.active > .title .tabs-container > .tab:hover {
.monaco-workbench .part.editor > .content .editor-group-container.active > .title .tabs-container > .tab:hover {
box-shadow: ${tabHoverBorder} 0 -1px inset !important;
}
`);
@@ -1237,7 +1238,7 @@ registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => {
const tabUnfocusedHoverBorder = theme.getColor(TAB_UNFOCUSED_HOVER_BORDER);
if (tabUnfocusedHoverBorder) {
collector.addRule(`
.monaco-workbench > .part.editor > .content .editor-group-container > .title .tabs-container > .tab:hover {
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab:hover {
box-shadow: ${tabUnfocusedHoverBorder} 0 -1px inset !important;
}
`);
@@ -1265,12 +1266,12 @@ registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => {
const adjustedColor = tabHoverBackground.flatten(adjustedTabBackground);
const adjustedColorDrag = tabHoverBackground.flatten(adjustedTabDragBackground);
collector.addRule(`
.monaco-workbench > .part.editor > .content:not(.dragged-over) .editor-group-container.active > .title .tabs-container > .tab.sizing-shrink:not(.dragged):hover > .tab-label::after {
.monaco-workbench .part.editor > .content:not(.dragged-over) .editor-group-container.active > .title .tabs-container > .tab.sizing-shrink:not(.dragged):hover > .tab-label::after {
background: linear-gradient(to left, ${adjustedColor}, transparent) !important;
}
.monaco-workbench > .part.editor > .content.dragged-over .editor-group-container.active > .title .tabs-container > .tab.sizing-shrink:not(.dragged):hover > .tab-label::after {
.monaco-workbench .part.editor > .content.dragged-over .editor-group-container.active > .title .tabs-container > .tab.sizing-shrink:not(.dragged):hover > .tab-label::after {
background: linear-gradient(to left, ${adjustedColorDrag}, transparent) !important;
}
`);
@@ -1281,11 +1282,11 @@ registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => {
const adjustedColor = tabUnfocusedHoverBackground.flatten(adjustedTabBackground);
const adjustedColorDrag = tabUnfocusedHoverBackground.flatten(adjustedTabDragBackground);
collector.addRule(`
.monaco-workbench > .part.editor > .content:not(.dragged-over) .editor-group-container > .title .tabs-container > .tab.sizing-shrink:not(.dragged):hover > .tab-label::after {
.monaco-workbench .part.editor > .content:not(.dragged-over) .editor-group-container > .title .tabs-container > .tab.sizing-shrink:not(.dragged):hover > .tab-label::after {
background: linear-gradient(to left, ${adjustedColor}, transparent) !important;
}
.monaco-workbench > .part.editor > .content.dragged-over .editor-group-container > .title .tabs-container > .tab.sizing-shrink:not(.dragged):hover > .tab-label::after {
.monaco-workbench .part.editor > .content.dragged-over .editor-group-container > .title .tabs-container > .tab.sizing-shrink:not(.dragged):hover > .tab-label::after {
background: linear-gradient(to left, ${adjustedColorDrag}, transparent) !important;
}
`);
@@ -1295,8 +1296,8 @@ registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => {
if (editorDragAndDropBackground && adjustedTabDragBackground) {
const adjustedColorDrag = editorDragAndDropBackground.flatten(adjustedTabDragBackground);
collector.addRule(`
.monaco-workbench > .part.editor > .content.dragged-over .editor-group-container.active > .title .tabs-container > .tab.sizing-shrink.dragged-over:not(.active):not(.dragged) > .tab-label::after,
.monaco-workbench > .part.editor > .content.dragged-over .editor-group-container:not(.active) > .title .tabs-container > .tab.sizing-shrink.dragged-over:not(.dragged) > .tab-label::after {
.monaco-workbench .part.editor > .content.dragged-over .editor-group-container.active > .title .tabs-container > .tab.sizing-shrink.dragged-over:not(.active):not(.dragged) > .tab-label::after,
.monaco-workbench .part.editor > .content.dragged-over .editor-group-container:not(.active) > .title .tabs-container > .tab.sizing-shrink.dragged-over:not(.dragged) > .tab-label::after {
background: linear-gradient(to left, ${adjustedColorDrag}, transparent) !important;
}
`);
@@ -1308,11 +1309,11 @@ registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => {
const adjustedColor = tabActiveBackground.flatten(adjustedTabBackground);
const adjustedColorDrag = tabActiveBackground.flatten(adjustedTabDragBackground);
collector.addRule(`
.monaco-workbench > .part.editor > .content:not(.dragged-over) .editor-group-container > .title .tabs-container > .tab.sizing-shrink.active:not(.dragged) > .tab-label::after {
.monaco-workbench .part.editor > .content:not(.dragged-over) .editor-group-container > .title .tabs-container > .tab.sizing-shrink.active:not(.dragged) > .tab-label::after {
background: linear-gradient(to left, ${adjustedColor}, transparent);
}
.monaco-workbench > .part.editor > .content.dragged-over .editor-group-container > .title .tabs-container > .tab.sizing-shrink.active:not(.dragged) > .tab-label::after {
.monaco-workbench .part.editor > .content.dragged-over .editor-group-container > .title .tabs-container > .tab.sizing-shrink.active:not(.dragged) > .tab-label::after {
background: linear-gradient(to left, ${adjustedColorDrag}, transparent);
}
`);
@@ -1324,11 +1325,11 @@ registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => {
const adjustedColor = tabInactiveBackground.flatten(adjustedTabBackground);
const adjustedColorDrag = tabInactiveBackground.flatten(adjustedTabDragBackground);
collector.addRule(`
.monaco-workbench > .part.editor > .content:not(.dragged-over) .editor-group-container > .title .tabs-container > .tab.sizing-shrink:not(.dragged) > .tab-label::after {
.monaco-workbench .part.editor > .content:not(.dragged-over) .editor-group-container > .title .tabs-container > .tab.sizing-shrink:not(.dragged) > .tab-label::after {
background: linear-gradient(to left, ${adjustedColor}, transparent);
}
.monaco-workbench > .part.editor > .content.dragged-over .editor-group-container > .title .tabs-container > .tab.sizing-shrink:not(.dragged) > .tab-label::after {
.monaco-workbench .part.editor > .content.dragged-over .editor-group-container > .title .tabs-container > .tab.sizing-shrink:not(.dragged) > .tab-label::after {
background: linear-gradient(to left, ${adjustedColorDrag}, transparent);
}
`);

View File

@@ -26,7 +26,7 @@ import { ScrollType, IDiffEditorViewState, IDiffEditorModel } from 'vs/editor/co
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { Registry } from 'vs/platform/registry/common/platform';
import { URI } from 'vs/base/common/uri';
import { once } from 'vs/base/common/event';
import { Event } from 'vs/base/common/event';
import { IEditorGroupsService } from 'vs/workbench/services/group/common/editorGroupsService';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { CancellationToken } from 'vs/base/common/cancellation';
@@ -73,7 +73,7 @@ export class TextDiffEditor extends BaseTextEditor implements ITextDiffEditor {
return this.instantiationService.createInstance(DiffEditorWidget, parent, configuration);
}
setInput(input: EditorInput, options: EditorOptions, token: CancellationToken): Thenable<void> {
setInput(input: EditorInput, options: EditorOptions, token: CancellationToken): Promise<void> {
// Dispose previous diff navigator
this.diffNavigatorDisposables = dispose(this.diffNavigatorDisposables);
@@ -87,12 +87,12 @@ export class TextDiffEditor extends BaseTextEditor implements ITextDiffEditor {
// Check for cancellation
if (token.isCancellationRequested) {
return void 0;
return undefined;
}
// Assert Model Instance
if (!(resolvedModel instanceof TextDiffEditorModel) && this.openAsBinary(input, options)) {
return void 0;
return undefined;
}
// Set Editor Model
@@ -282,7 +282,7 @@ export class TextDiffEditor extends BaseTextEditor implements ITextDiffEditor {
super.saveTextEditorViewState(resource);
// Make sure to clean up when the input gets disposed
once(input.onDispose)(() => {
Event.once(input.onDispose)(() => {
super.clearTextEditorViewState([resource]);
});
}

View File

@@ -40,7 +40,7 @@ export abstract class BaseTextEditor extends BaseEditor implements ITextEditor {
private editorControl: IEditor;
private _editorContainer: HTMLElement;
private hasPendingConfigurationChange: boolean;
private lastAppliedEditorOptions: IEditorOptions;
private lastAppliedEditorOptions?: IEditorOptions;
private editorMemento: IEditorMemento<IEditorViewState>;
constructor(
@@ -53,13 +53,17 @@ export abstract class BaseTextEditor extends BaseEditor implements ITextEditor {
@ITextFileService private readonly _textFileService: ITextFileService,
@IEditorService protected editorService: IEditorService,
@IEditorGroupsService protected editorGroupService: IEditorGroupsService,
@IWindowService private windowService: IWindowService
@IWindowService private readonly windowService: IWindowService
) {
super(id, telemetryService, themeService, storageService);
this.editorMemento = this.getEditorMemento<IEditorViewState>(editorGroupService, TEXT_EDITOR_VIEW_STATE_PREFERENCE_KEY, 100);
this._register(this.configurationService.onDidChangeConfiguration(e => this.handleConfigurationChangeEvent(this.configurationService.getValue<IEditorConfiguration>(this.getResource()))));
this._register(this.configurationService.onDidChangeConfiguration(e => {
const resource = this.getResource();
const value = resource ? this.configurationService.getValue<IEditorConfiguration>(resource) : undefined;
return this.handleConfigurationChangeEvent(value);
}));
}
protected get instantiationService(): IInstantiationService {
@@ -129,7 +133,7 @@ export abstract class BaseTextEditor extends BaseEditor implements ITextEditor {
// Editor for Text
this._editorContainer = parent;
this.editorControl = this._register(this.createEditorControl(parent, this.computeConfiguration(this.configurationService.getValue<IEditorConfiguration>(this.getResource()))));
this.editorControl = this._register(this.createEditorControl(parent, this.computeConfiguration(this.configurationService.getValue<IEditorConfiguration>(this.getResource()!))));
// Model & Language changes
const codeEditor = getCodeEditor(this.editorControl);
@@ -170,7 +174,7 @@ export abstract class BaseTextEditor extends BaseEditor implements ITextEditor {
(reason === SaveReason.FOCUS_CHANGE && mode === AutoSaveMode.ON_FOCUS_CHANGE)
) {
if (this.textFileService.isDirty()) {
this.textFileService.saveAll(void 0, { reason });
this.textFileService.saveAll(undefined, { reason });
}
}
}
@@ -187,7 +191,7 @@ export abstract class BaseTextEditor extends BaseEditor implements ITextEditor {
return this.instantiationService.createInstance(CodeEditorWidget, parent, configuration, {});
}
setInput(input: EditorInput, options: EditorOptions, token: CancellationToken): Thenable<void> {
setInput(input: EditorInput, options: EditorOptions, token: CancellationToken): Promise<void> {
return super.setInput(input, options, token).then(() => {
// Update editor options after having set the input. We do this because there can be
@@ -229,14 +233,14 @@ export abstract class BaseTextEditor extends BaseEditor implements ITextEditor {
*/
protected saveTextEditorViewState(resource: URI): void {
const editorViewState = this.retrieveTextEditorViewState(resource);
if (!editorViewState) {
if (!editorViewState || !this.group) {
return;
}
this.editorMemento.saveEditorState(this.group, resource, editorViewState);
}
protected retrieveTextEditorViewState(resource: URI): IEditorViewState {
protected retrieveTextEditorViewState(resource: URI): IEditorViewState | null {
const control = this.getControl() as ICodeEditor;
const model = control.getModel();
if (!model) {
@@ -267,12 +271,18 @@ export abstract class BaseTextEditor extends BaseEditor implements ITextEditor {
/**
* Loads the text editor view state for the given resource and returns it.
*/
protected loadTextEditorViewState(resource: URI): IEditorViewState {
return this.editorMemento.loadEditorState(this.group, resource);
protected loadTextEditorViewState(resource: URI): IEditorViewState | undefined {
return this.group ? this.editorMemento.loadEditorState(this.group, resource) : undefined;
}
private updateEditorConfiguration(configuration = this.configurationService.getValue<IEditorConfiguration>(this.getResource())): void {
if (!this.editorControl) {
private updateEditorConfiguration(configuration?: IEditorConfiguration): void {
if (!configuration) {
const resource = this.getResource();
if (resource) {
configuration = this.configurationService.getValue<IEditorConfiguration>(resource);
}
}
if (!this.editorControl || !configuration) {
return;
}
@@ -292,7 +302,7 @@ export abstract class BaseTextEditor extends BaseEditor implements ITextEditor {
}
}
protected getResource(): URI {
protected getResource(): URI | null {
const codeEditor = getCodeEditor(this.editorControl);
if (codeEditor) {
const model = codeEditor.getModel();
@@ -311,7 +321,7 @@ export abstract class BaseTextEditor extends BaseEditor implements ITextEditor {
protected abstract getAriaLabel(): string;
dispose(): void {
this.lastAppliedEditorOptions = void 0;
this.lastAppliedEditorOptions = undefined;
super.dispose();
}

View File

@@ -18,7 +18,7 @@ import { ITextResourceConfigurationService } from 'vs/editor/common/services/res
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
import { once } from 'vs/base/common/event';
import { Event } from 'vs/base/common/event';
import { ScrollType } from 'vs/editor/common/editorCommon';
import { IEditorGroupsService } from 'vs/workbench/services/group/common/editorGroupsService';
import { CancellationToken } from 'vs/base/common/cancellation';
@@ -54,7 +54,7 @@ export class AbstractTextResourceEditor extends BaseTextEditor {
return nls.localize('textEditor', "Text Editor");
}
setInput(input: EditorInput, options: EditorOptions, token: CancellationToken): Thenable<void> {
setInput(input: EditorInput, options: EditorOptions, token: CancellationToken): Promise<void> {
// Remember view settings if input changes
this.saveTextResourceEditorViewState(this.input);
@@ -65,7 +65,7 @@ export class AbstractTextResourceEditor extends BaseTextEditor {
// Check for cancellation
if (token.isCancellationRequested) {
return void 0;
return undefined;
}
// Assert Model instance
@@ -90,7 +90,7 @@ export class AbstractTextResourceEditor extends BaseTextEditor {
this.restoreTextResourceEditorViewState(input);
}
return void 0;
return undefined;
});
});
}
@@ -136,19 +136,14 @@ export class AbstractTextResourceEditor extends BaseTextEditor {
/**
* Reveals the last line of this editor if it has a model set.
* When smart is true only scroll if the cursor is currently on the last line of the output panel.
* This allows users to click on the output panel to stop scrolling when they see something of interest.
* To resume, they should scroll to the end of the output panel again.
*/
revealLastLine(smart: boolean): void {
revealLastLine(): void {
const codeEditor = <ICodeEditor>this.getControl();
const model = codeEditor.getModel();
if (model) {
const lastLine = model.getLineCount();
if (!smart || codeEditor.getPosition().lineNumber === lastLine) {
codeEditor.revealPosition({ lineNumber: lastLine, column: model.getLineMaxColumn(lastLine) }, ScrollType.Smooth);
}
codeEditor.revealPosition({ lineNumber: lastLine, column: model.getLineMaxColumn(lastLine) }, ScrollType.Smooth);
}
}
@@ -190,7 +185,7 @@ export class AbstractTextResourceEditor extends BaseTextEditor {
super.saveTextEditorViewState(resource);
// Make sure to clean up when the input gets disposed
once(input.onDispose)(() => {
Event.once(input.onDispose)(() => {
super.clearTextEditorViewState([resource]);
});
}

View File

@@ -65,17 +65,17 @@ export abstract class TitleControl extends Themable {
parent: HTMLElement,
protected accessor: IEditorGroupsAccessor,
protected group: IEditorGroupView,
@IContextMenuService private contextMenuService: IContextMenuService,
@IContextMenuService private readonly contextMenuService: IContextMenuService,
@IInstantiationService protected instantiationService: IInstantiationService,
@IContextKeyService private contextKeyService: IContextKeyService,
@IKeybindingService private keybindingService: IKeybindingService,
@ITelemetryService private telemetryService: ITelemetryService,
@IContextKeyService private readonly contextKeyService: IContextKeyService,
@IKeybindingService private readonly keybindingService: IKeybindingService,
@ITelemetryService private readonly telemetryService: ITelemetryService,
// {{SQL CARBON EDIT}} -- need to make the notification service protected
@INotificationService protected notificationService: INotificationService,
@IMenuService private menuService: IMenuService,
@INotificationService protected readonly notificationService: INotificationService,
@IMenuService private readonly menuService: IMenuService,
@IQuickOpenService protected quickOpenService: IQuickOpenService,
@IThemeService themeService: IThemeService,
@IExtensionService private extensionService: IExtensionService,
@IExtensionService private readonly extensionService: IExtensionService,
@IConfigurationService protected configurationService: IConfigurationService,
@IFileService private readonly fileService: IFileService,
) {
@@ -320,11 +320,9 @@ export abstract class TitleControl extends Themable {
protected getKeybindingLabel(action: IAction): string {
const keybinding = this.getKeybinding(action);
return keybinding ? keybinding.getLabel() : void 0;
return keybinding ? keybinding.getLabel() : undefined;
}
//#region ITitleAreaControl
abstract openEditor(editor: IEditorInput): void;
abstract closeEditor(editor: IEditorInput): void;
@@ -348,8 +346,6 @@ export abstract class TitleControl extends Themable {
abstract updateStyles(): void;
layout(dimension: Dimension): void {
// Optionally implemented in subclasses
if (this.breadcrumbsControl) {
this.breadcrumbsControl.layout(undefined);
}
@@ -365,8 +361,6 @@ export abstract class TitleControl extends Themable {
super.dispose();
}
//#endregion
}
registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => {