Merge from vscode 2b0b9136329c181a9e381463a1f7dc3a2d105a34 (#4880)

This commit is contained in:
Karl Burtram
2019-04-05 10:09:18 -07:00
committed by GitHub
parent 9bd7e30d18
commit cb5bcf2248
433 changed files with 8915 additions and 8361 deletions

View File

@@ -14,7 +14,7 @@ import { ToolBar } from 'vs/base/browser/ui/toolbar/toolbar';
import { IActionItem, ActionsOrientation } from 'vs/base/browser/ui/actionbar/actionbar';
import { ProgressBar } from 'vs/base/browser/ui/progressbar/progressbar';
import { prepareActions } from 'vs/workbench/browser/actions';
import { Action, IAction } from 'vs/base/common/actions';
import { IAction } from 'vs/base/common/actions';
import { Part, IPartOptions } from 'vs/workbench/browser/part';
import { Composite, CompositeRegistry } from 'vs/workbench/browser/composite';
import { IComposite } from 'vs/workbench/common/composite';
@@ -399,7 +399,7 @@ export abstract class CompositePart<T extends Composite> extends Part {
// Toolbar
this.toolBar = this._register(new ToolBar(titleActionsContainer, this.contextMenuService, {
actionItemProvider: action => this.actionItemProvider(action as Action),
actionItemProvider: action => this.actionItemProvider(action),
orientation: ActionsOrientation.HORIZONTAL,
getKeyBinding: action => this.keybindingService.lookupKeybinding(action.id),
anchorAlignmentProvider: () => this.getTitleAreaDropDownAnchorAlignment()
@@ -432,7 +432,7 @@ export abstract class CompositePart<T extends Composite> extends Part {
this.titleLabel.updateStyles();
}
protected actionItemProvider(action: Action): IActionItem | undefined {
protected actionItemProvider(action: IAction): IActionItem | undefined {
// Check Active Composite
if (this.activeComposite) {
@@ -442,7 +442,7 @@ export abstract class CompositePart<T extends Composite> extends Part {
return undefined;
}
protected actionsContextProvider(): any {
protected actionsContextProvider(): unknown {
// Check Active Composite
if (this.activeComposite) {

View File

@@ -248,7 +248,7 @@ export class EditorMemento<T> implements IEditorMemento<T> {
}
}
private doGetResource(resourceOrEditor: URI | EditorInput): URI | null {
private doGetResource(resourceOrEditor: URI | EditorInput): URI | undefined {
if (resourceOrEditor instanceof EditorInput) {
return resourceOrEditor.getResource();
}

View File

@@ -40,7 +40,7 @@ export abstract class BaseBinaryResourceEditor extends BaseEditor {
private metadata: string | undefined;
private binaryContainer: HTMLElement;
private scrollbar: DomScrollableElement;
private resourceViewerContext: ResourceViewerContext;
private resourceViewerContext: ResourceViewerContext | undefined;
constructor(
id: string,
@@ -127,7 +127,8 @@ export abstract class BaseBinaryResourceEditor extends BaseEditor {
// Clear Resource Viewer
clearNode(this.binaryContainer);
this.resourceViewerContext = dispose(this.resourceViewerContext);
dispose(this.resourceViewerContext);
this.resourceViewerContext = undefined;
super.clearInput();
}
@@ -149,7 +150,8 @@ export abstract class BaseBinaryResourceEditor extends BaseEditor {
dispose(): void {
this.binaryContainer.remove();
this.resourceViewerContext = dispose(this.resourceViewerContext);
dispose(this.resourceViewerContext);
this.resourceViewerContext = undefined;
super.dispose();
}

View File

@@ -30,7 +30,7 @@ export class ExecuteCommandAction extends Action {
label: string,
private commandId: string,
private commandService: ICommandService,
private commandArgs?: any
private commandArgs?: unknown
) {
super(id, label);
}
@@ -429,14 +429,16 @@ export class OpenToSideFromQuickOpenAction extends Action {
const entry = toEditorQuickOpenEntry(context);
if (entry) {
const input = entry.getInput();
if (input instanceof EditorInput) {
return this.editorService.openEditor(input, entry.getOptions() || undefined, SIDE_GROUP);
if (input) {
if (input instanceof EditorInput) {
return this.editorService.openEditor(input, entry.getOptions() || undefined, SIDE_GROUP);
}
const resourceInput = input as IResourceInput;
resourceInput.options = mixin(resourceInput.options, entry.getOptions());
return this.editorService.openEditor(resourceInput, SIDE_GROUP);
}
const resourceInput = input as IResourceInput;
resourceInput.options = mixin(resourceInput.options, entry.getOptions());
return this.editorService.openEditor(resourceInput, SIDE_GROUP);
}
return Promise.resolve(false);

View File

@@ -762,13 +762,13 @@ export function getMultiSelectedEditorContexts(editorContext: IEditorCommandsCon
return !!editorContext ? [editorContext] : [];
}
function isEditorGroup(thing: any): thing is IEditorGroup {
function isEditorGroup(thing: unknown): thing is IEditorGroup {
const group = thing as IEditorGroup;
return group && typeof group.id === 'number' && Array.isArray(group.editors);
}
function isEditorIdentifier(thing: any): thing is IEditorIdentifier {
function isEditorIdentifier(thing: unknown): thing is IEditorIdentifier {
const identifier = thing as IEditorIdentifier;
return identifier && typeof identifier.groupId === 'number';

View File

@@ -68,7 +68,7 @@ export class EditorControl extends Disposable {
const control = this.doShowEditorControl(descriptor);
// Set input
return this.doSetInput(control, editor, withUndefinedAsNull(options)).then((editorChanged => (({ control, editorChanged } as IOpenEditorResult))));
return this.doSetInput(control, editor, withUndefinedAsNull(options)).then((editorChanged => (({ control, editorChanged }))));
}
private doShowEditorControl(descriptor: IEditorDescriptor): BaseEditor {

View File

@@ -257,12 +257,16 @@ class DropOverlay extends Themable {
// Check for URI transfer
else {
const dropHandler = this.instantiationService.createInstance(ResourcesDropHandler, { allowWorkspaceOpen: true /* open workspace instead of file if dropped */ });
dropHandler.handleDrop(event, () => ensureTargetGroup(), targetGroup => targetGroup!.focus());
dropHandler.handleDrop(event, () => ensureTargetGroup(), targetGroup => {
if (targetGroup) {
targetGroup.focus();
}
});
}
}
private isCopyOperation(e: DragEvent, draggedEditor?: IEditorIdentifier): boolean {
if (draggedEditor && !(draggedEditor.editor as EditorInput).supportsSplitEditor()) {
if (draggedEditor && draggedEditor.editor instanceof EditorInput && !draggedEditor.editor.supportsSplitEditor()) {
return false;
}

View File

@@ -49,7 +49,7 @@ import { GlobalNewUntitledFileAction } from 'vs/workbench/contrib/files/browser/
import { isErrorWithActions, IErrorWithActions } from 'vs/base/common/errorsWithActions';
import { IVisibleEditor } from 'vs/workbench/services/editor/common/editorService';
import { withNullAsUndefined } from 'vs/base/common/types';
import { IHashService } from 'vs/workbench/services/hash/common/hashService';
import { hash } from 'vs/base/common/hash';
import { guessMimeTypes } from 'vs/base/common/mime';
import { extname } from 'vs/base/common/path';
@@ -132,7 +132,6 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
@IKeybindingService private readonly keybindingService: IKeybindingService,
@IMenuService private readonly menuService: IMenuService,
@IContextMenuService private readonly contextMenuService: IContextMenuService,
@IHashService private readonly hashService: IHashService,
// {{SQL CARBON EDIT}}
@ICommandService private commandService: ICommandService
) {
@@ -224,7 +223,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
let activeEditorListener: IDisposable;
const observeActiveEditor = () => {
activeEditorListener = dispose(activeEditorListener);
dispose(activeEditorListener);
const activeEditor = this._group.activeEditor;
if (activeEditor) {
@@ -467,16 +466,14 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
private onDidEditorOpen(editor: EditorInput): void {
// Telemetry
this.toEditorTelemetryDescriptor(editor).then(descriptor => {
/* __GDPR__
"editorOpened" : {
"${include}": [
"${EditorTelemetryDescriptor}"
]
}
*/
this.telemetryService.publicLog('editorOpened', descriptor);
});
/* __GDPR__
"editorOpened" : {
"${include}": [
"${EditorTelemetryDescriptor}"
]
}
*/
this.telemetryService.publicLog('editorOpened', this.toEditorTelemetryDescriptor(editor));
// Update container
this.updateContainer();
@@ -508,16 +505,14 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
});
// Telemetry
this.toEditorTelemetryDescriptor(event.editor).then(descriptor => {
/* __GDPR__
/* __GDPR__
"editorClosed" : {
"${include}": [
"${EditorTelemetryDescriptor}"
]
}
*/
this.telemetryService.publicLog('editorClosed', descriptor);
});
this.telemetryService.publicLog('editorClosed', this.toEditorTelemetryDescriptor(event.editor));
// Update container
this.updateContainer();
@@ -527,24 +522,22 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
this._onDidGroupChange.fire({ kind: GroupChangeKind.EDITOR_CLOSE, editor, editorIndex: event.index });
}
private toEditorTelemetryDescriptor(editor: EditorInput): Thenable<object> {
private toEditorTelemetryDescriptor(editor: EditorInput): object {
const descriptor = editor.getTelemetryDescriptor();
const resource = editor.getResource();
if (resource && resource.fsPath) {
return this.hashService.createSHA1(resource.fsPath).then(hashedPath => {
descriptor['resource'] = { mimeType: guessMimeTypes(resource.fsPath).join(', '), scheme: resource.scheme, ext: extname(resource.fsPath), path: hashedPath };
descriptor['resource'] = { mimeType: guessMimeTypes(resource.fsPath).join(', '), scheme: resource.scheme, ext: extname(resource.fsPath), path: hash(resource.fsPath) };
/* __GDPR__FRAGMENT__
"EditorTelemetryDescriptor" : {
"resource": { "${inline}": [ "${URIDescriptor}" ] }
}
*/
return descriptor;
});
/* __GDPR__FRAGMENT__
"EditorTelemetryDescriptor" : {
"resource": { "${inline}": [ "${URIDescriptor}" ] }
}
*/
return descriptor;
}
return Promise.resolve(descriptor);
return descriptor;
}
private onDidEditorDispose(editor: EditorInput): void {
@@ -1229,10 +1222,10 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
}
// Filter: direction (left / right)
else if (hasDirection) {
else if (hasDirection && filter.except) {
editorsToClose = (filter.direction === CloseDirection.LEFT) ?
editorsToClose.slice(0, this._group.indexOf(filter.except as EditorInput)) :
editorsToClose.slice(this._group.indexOf(filter.except as EditorInput) + 1);
editorsToClose.slice(0, this._group.indexOf(filter.except)) :
editorsToClose.slice(this._group.indexOf(filter.except) + 1);
}
// Filter: except

View File

@@ -844,7 +844,7 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro
}
private doCreateGridControlWithPreviousState(): boolean {
const uiState = this.workspaceMemento[EditorPart.EDITOR_PART_UI_STATE_STORAGE_KEY] as IEditorPartUIState;
const uiState: IEditorPartUIState = this.workspaceMemento[EditorPart.EDITOR_PART_UI_STATE_STORAGE_KEY];
if (uiState && uiState.serializedGrid) {
try {

View File

@@ -6,10 +6,10 @@
import 'vs/css!./media/editorstatus';
import * as nls from 'vs/nls';
import { $, append, runAtThisOrScheduleAtNextAnimationFrame } from 'vs/base/browser/dom';
import * as strings from 'vs/base/common/strings';
import { format } from 'vs/base/common/strings';
import { extname, basename } from 'vs/base/common/resources';
import * as types from 'vs/base/common/types';
import { URI as uri } from 'vs/base/common/uri';
import { areFunctions, withNullAsUndefined } from 'vs/base/common/types';
import { URI } from 'vs/base/common/uri';
import { IStatusbarItem } from 'vs/workbench/browser/parts/statusbar/statusbar';
import { Action } from 'vs/base/common/actions';
import { Language } from 'vs/base/common/platform';
@@ -87,7 +87,7 @@ function toEditorWithEncodingSupport(input: IEditorInput): IEncodingSupport | nu
// File or Resource Editor
let encodingSupport = input as IFileEditorInput;
if (types.areFunctions(encodingSupport.setEncoding, encodingSupport.getEncoding)) {
if (areFunctions(encodingSupport.setEncoding, encodingSupport.getEncoding)) {
return encodingSupport;
}
@@ -457,18 +457,18 @@ export class EditorStatus implements IStatusbarItem {
if (info.selections.length === 1) {
if (info.charactersSelected) {
return strings.format(nlsSingleSelectionRange, info.selections[0].positionLineNumber, info.selections[0].positionColumn, info.charactersSelected);
return format(nlsSingleSelectionRange, info.selections[0].positionLineNumber, info.selections[0].positionColumn, info.charactersSelected);
}
return strings.format(nlsSingleSelection, info.selections[0].positionLineNumber, info.selections[0].positionColumn);
return format(nlsSingleSelection, info.selections[0].positionLineNumber, info.selections[0].positionColumn);
}
if (info.charactersSelected) {
return strings.format(nlsMultiSelectionRange, info.selections.length, info.charactersSelected);
return format(nlsMultiSelectionRange, info.selections.length, info.charactersSelected);
}
if (info.selections.length > 0) {
return strings.format(nlsMultiSelection, info.selections.length);
return format(nlsMultiSelection, info.selections.length);
}
return undefined;
@@ -536,7 +536,7 @@ export class EditorStatus implements IStatusbarItem {
private updateStatusBar(): void {
const activeControl = this.editorService.activeControl;
const activeCodeEditor = activeControl ? types.withNullAsUndefined(getCodeEditor(activeControl.getControl())) : undefined;
const activeCodeEditor = activeControl ? withNullAsUndefined(getCodeEditor(activeControl.getControl())) : undefined;
// Update all states
this.onScreenReaderModeChange(activeCodeEditor);
@@ -769,7 +769,7 @@ export class EditorStatus implements IStatusbarItem {
this.updateState(info);
}
private onResourceEncodingChange(resource: uri): void {
private onResourceEncodingChange(resource: URI): void {
const activeControl = this.editorService.activeControl;
if (activeControl) {
const activeResource = toResource(activeControl.input, { supportSideBySide: true });
@@ -876,14 +876,14 @@ export class ChangeModeAction extends Action {
}
// construct a fake resource to be able to show nice icons if any
let fakeResource: uri | undefined;
let fakeResource: URI | undefined;
const extensions = this.modeService.getExtensions(lang);
if (extensions && extensions.length) {
fakeResource = uri.file(extensions[0]);
fakeResource = URI.file(extensions[0]);
} else {
const filenames = this.modeService.getFilenames(lang);
if (filenames && filenames.length) {
fakeResource = uri.file(filenames[0]);
fakeResource = URI.file(filenames[0]);
}
}
@@ -997,7 +997,7 @@ export class ChangeModeAction extends Action {
});
}
private configureFileAssociation(resource: uri): void {
private configureFileAssociation(resource: URI): void {
const extension = extname(resource);
const base = basename(resource);
const currentAssociation = this.modeService.getModeIdByFilepathOrFirstLine(base);
@@ -1208,7 +1208,7 @@ export class ChangeEncodingAction extends Action {
.then((guessedEncoding: string) => {
const isReopenWithEncoding = (action === reopenWithEncodingPick);
const configuredEncoding = this.textResourceConfigurationService.getValue(types.withNullAsUndefined(resource), 'files.encoding');
const configuredEncoding = this.textResourceConfigurationService.getValue(withNullAsUndefined(resource), 'files.encoding');
let directMatchIndex: number | undefined;
let aliasMatchIndex: number | undefined;

View File

@@ -101,7 +101,7 @@ export class OpenWorkspaceButtonContribution extends Disposable implements IEdit
private static readonly ID = 'editor.contrib.openWorkspaceButton';
private openWorkspaceButton: FloatingClickWidget;
private openWorkspaceButton: FloatingClickWidget | undefined;
constructor(
private editor: ICodeEditor,
@@ -163,7 +163,7 @@ export class OpenWorkspaceButtonContribution extends Disposable implements IEdit
this._register(this.openWorkspaceButton.onClick(() => {
const model = this.editor.getModel();
if (model) {
this.windowService.openWindow([{ uri: model.uri, typeHint: 'file' }]);
this.windowService.openWindow([{ fileUri: model.uri }]);
}
}));
@@ -172,7 +172,8 @@ export class OpenWorkspaceButtonContribution extends Disposable implements IEdit
}
private disposeOpenWorkspaceWidgetRenderer(): void {
this.openWorkspaceButton = dispose(this.openWorkspaceButton);
dispose(this.openWorkspaceButton);
this.openWorkspaceButton = undefined;
}
dispose(): void {

View File

@@ -141,12 +141,12 @@ export class SideBySideEditor extends BaseEditor {
this.splitview.layout(dimension.width);
}
getControl(): IEditorControl | null {
getControl(): IEditorControl | undefined {
if (this.masterEditor) {
return this.masterEditor.getControl();
}
return null;
return undefined;
}
getMasterEditor(): IEditor | undefined {

View File

@@ -227,7 +227,7 @@ export class TextDiffEditor extends BaseTextEditor implements ITextDiffEditor {
private isFileBinaryError(error: Error[]): boolean;
private isFileBinaryError(error: Error): boolean;
private isFileBinaryError(error: any): boolean {
private isFileBinaryError(error: Error | Error[]): boolean {
if (types.isArray(error)) {
const errors = <Error[]>error;
return errors.some(e => this.isFileBinaryError(e));
@@ -312,9 +312,9 @@ export class TextDiffEditor extends BaseTextEditor implements ITextDiffEditor {
return control.saveViewState();
}
private toDiffEditorViewStateResource(modelOrInput: IDiffEditorModel | DiffEditorInput): URI | null {
let original: URI | null;
let modified: URI | null;
private toDiffEditorViewStateResource(modelOrInput: IDiffEditorModel | DiffEditorInput): URI | undefined {
let original: URI | undefined;
let modified: URI | undefined;
if (modelOrInput instanceof DiffEditorInput) {
original = modelOrInput.originalInput.getResource();
@@ -325,7 +325,7 @@ export class TextDiffEditor extends BaseTextEditor implements ITextDiffEditor {
}
if (!original || !modified) {
return null;
return undefined;
}
// create a URI that is the Base64 concatenation of original + modified resource

View File

@@ -19,7 +19,7 @@ import { IThemeService } from 'vs/platform/theme/common/themeService';
import { ITextFileService, SaveReason, AutoSaveMode } from 'vs/workbench/services/textfile/common/textfiles';
import { ITextResourceConfigurationService } from 'vs/editor/common/services/resourceConfiguration';
import { IEditorOptions } from 'vs/editor/common/config/editorOptions';
import { isDiffEditor, isCodeEditor, ICodeEditor, getCodeEditor } from 'vs/editor/browser/editorBrowser';
import { isDiffEditor, isCodeEditor, getCodeEditor } from 'vs/editor/browser/editorBrowser';
import { IEditorGroupsService, IEditorGroup } from 'vs/workbench/services/editor/common/editorGroupsService';
import { CancellationToken } from 'vs/base/common/cancellation';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
@@ -241,7 +241,11 @@ export abstract class BaseTextEditor extends BaseEditor implements ITextEditor {
}
protected retrieveTextEditorViewState(resource: URI): IEditorViewState | null {
const control = this.getControl() as ICodeEditor;
const control = this.getControl();
if (!isCodeEditor(control)) {
return null;
}
const model = control.getModel();
if (!model) {
return null; // view state always needs a model
@@ -302,7 +306,7 @@ export abstract class BaseTextEditor extends BaseEditor implements ITextEditor {
}
}
protected getResource(): URI | null {
protected getResource(): URI | undefined {
const codeEditor = getCodeEditor(this.editorControl);
if (codeEditor) {
const model = codeEditor.getModel();
@@ -315,7 +319,7 @@ export abstract class BaseTextEditor extends BaseEditor implements ITextEditor {
return this.input.getResource();
}
return null;
return undefined;
}
protected abstract getAriaLabel(): string;

View File

@@ -8,7 +8,7 @@ import { addDisposableListener, Dimension, EventType } from 'vs/base/browser/dom
import { StandardMouseEvent } from 'vs/base/browser/mouseEvent';
import { ActionsOrientation, IActionItem } from 'vs/base/browser/ui/actionbar/actionbar';
import { ToolBar } from 'vs/base/browser/ui/toolbar/toolbar';
import { Action, IAction, IRunEvent } from 'vs/base/common/actions';
import { IAction, IRunEvent } from 'vs/base/common/actions';
import * as arrays from 'vs/base/common/arrays';
import { ResolvedKeybinding } from 'vs/base/common/keyCodes';
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
@@ -123,10 +123,10 @@ export abstract class TitleControl extends Themable {
protected abstract handleBreadcrumbsEnablementChange(): void;
protected createEditorActionsToolBar(container: HTMLElement): void {
const context = { groupId: this.group.id } as IEditorCommandsContext;
const context: IEditorCommandsContext = { groupId: this.group.id };
this.editorActionsToolbar = this._register(new ToolBar(container, this.contextMenuService, {
actionItemProvider: action => this.actionItemProvider(action as Action),
actionItemProvider: action => this.actionItemProvider(action),
orientation: ActionsOrientation.HORIZONTAL,
ariaLabel: localize('araLabelEditorActions', "Editor actions"),
getKeyBinding: action => this.getKeybinding(action),
@@ -156,7 +156,7 @@ export abstract class TitleControl extends Themable {
}));
}
private actionItemProvider(action: Action): IActionItem | undefined {
private actionItemProvider(action: IAction): IActionItem | undefined {
const activeControl = this.group.activeControl;
// Check Active Editor
@@ -303,7 +303,7 @@ export abstract class TitleControl extends Themable {
this.contextMenuService.showContextMenu({
getAnchor: () => anchor,
getActions: () => actions,
getActionsContext: () => ({ groupId: this.group.id, editorIndex: this.group.getIndexOfEditor(editor) } as IEditorCommandsContext),
getActionsContext: () => ({ groupId: this.group.id, editorIndex: this.group.getIndexOfEditor(editor) }),
getKeyBinding: (action) => this.getKeybinding(action),
onHide: () => {

View File

@@ -57,7 +57,7 @@ export interface INotificationsToastController {
export function registerNotificationCommands(center: INotificationsCenterController, toasts: INotificationsToastController): void {
function getNotificationFromContext(listService: IListService, context?: any): INotificationViewItem | undefined {
function getNotificationFromContext(listService: IListService, context?: unknown): INotificationViewItem | undefined {
if (isNotificationViewItem(context)) {
return context;
}

View File

@@ -16,7 +16,7 @@ import { IAction, IActionRunner } from 'vs/base/common/actions';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { DropdownMenuActionItem, IContextMenuProvider } from 'vs/base/browser/ui/dropdown/dropdown';
import { DropdownMenuActionItem } from 'vs/base/browser/ui/dropdown/dropdown';
import { INotificationViewItem, NotificationViewItem, NotificationViewItemLabelKind, INotificationMessage, ChoiceAction } from 'vs/workbench/common/notifications';
import { ClearNotificationAction, ExpandNotificationAction, CollapseNotificationAction, ConfigureNotificationAction } from 'vs/workbench/browser/parts/notifications/notificationsActions';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
@@ -221,7 +221,7 @@ export class NotificationRenderer implements IListRenderer<INotificationViewItem
ariaLabel: localize('notificationActions', "Notification Actions"),
actionItemProvider: action => {
if (action && action instanceof ConfigureNotificationAction) {
const item = new DropdownMenuActionItem(action, action.configurationActions, this.contextMenuService as IContextMenuProvider, undefined, this.actionRunner, undefined, action.class as string);
const item = new DropdownMenuActionItem(action, action.configurationActions, this.contextMenuService, undefined, this.actionRunner, undefined, action.class);
data.toDispose.push(item);
return item;

View File

@@ -19,7 +19,7 @@ import { StatusbarAlignment, IStatusbarService, IStatusbarEntry } from 'vs/platf
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { Action } from 'vs/base/common/actions';
import { IThemeService, registerThemingParticipant, ITheme, ICssStyleCollector, ThemeColor } from 'vs/platform/theme/common/themeService';
import { STATUS_BAR_BACKGROUND, STATUS_BAR_FOREGROUND, STATUS_BAR_NO_FOLDER_BACKGROUND, STATUS_BAR_ITEM_HOVER_BACKGROUND, STATUS_BAR_ITEM_ACTIVE_BACKGROUND, STATUS_BAR_PROMINENT_ITEM_BACKGROUND, STATUS_BAR_PROMINENT_ITEM_HOVER_BACKGROUND, STATUS_BAR_BORDER, STATUS_BAR_NO_FOLDER_FOREGROUND, STATUS_BAR_NO_FOLDER_BORDER } from 'vs/workbench/common/theme';
import { STATUS_BAR_BACKGROUND, STATUS_BAR_FOREGROUND, STATUS_BAR_NO_FOLDER_BACKGROUND, STATUS_BAR_ITEM_HOVER_BACKGROUND, STATUS_BAR_ITEM_ACTIVE_BACKGROUND, STATUS_BAR_PROMINENT_ITEM_FOREGROUND, STATUS_BAR_PROMINENT_ITEM_BACKGROUND, STATUS_BAR_PROMINENT_ITEM_HOVER_BACKGROUND, STATUS_BAR_BORDER, STATUS_BAR_NO_FOLDER_FOREGROUND, STATUS_BAR_NO_FOLDER_BORDER } from 'vs/workbench/common/theme';
import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace';
import { contrastBorder } from 'vs/platform/theme/common/colorRegistry';
import { isThemeColor } from 'vs/editor/common/editorCommon';
@@ -329,11 +329,7 @@ class StatusBarEntryItem implements IStatusbarItem {
el.appendChild(textContainer);
return {
dispose: () => {
toDispose = dispose(toDispose);
}
};
return toDisposable(() => toDispose = dispose(toDispose));
}
private applyColor(container: HTMLElement, color: string | ThemeColor | undefined, isBackground?: boolean): IDisposable {
@@ -354,7 +350,7 @@ class StatusBarEntryItem implements IStatusbarItem {
return combinedDisposable(disposable);
}
private executeCommand(id: string, args?: any[]) {
private executeCommand(id: string, args?: unknown[]) {
args = args || [];
// Maintain old behaviour of always focusing the editor here
@@ -398,6 +394,11 @@ registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => {
collector.addRule(`.monaco-workbench .part.statusbar > .statusbar-item a:active { background-color: ${statusBarItemActiveBackground}; }`);
}
const statusBarProminentItemForeground = theme.getColor(STATUS_BAR_PROMINENT_ITEM_FOREGROUND);
if (statusBarProminentItemForeground) {
collector.addRule(`.monaco-workbench .part.statusbar > .statusbar-item .status-bar-info { color: ${statusBarProminentItemForeground}; }`);
}
const statusBarProminentItemBackground = theme.getColor(STATUS_BAR_PROMINENT_ITEM_BACKGROUND);
if (statusBarProminentItemBackground) {
collector.addRule(`.monaco-workbench .part.statusbar > .statusbar-item .status-bar-info { background-color: ${statusBarProminentItemBackground}; }`);

View File

@@ -7,7 +7,7 @@ import * as nls from 'vs/nls';
import { IMenubarMenu, IMenubarMenuItemAction, IMenubarMenuItemSubmenu, IMenubarKeybinding, IMenubarService, IMenubarData, MenubarMenuItem } from 'vs/platform/menubar/common/menubar';
import { IMenuService, MenuId, IMenu, SubmenuItemAction } from 'vs/platform/actions/common/actions';
import { registerThemingParticipant, ITheme, ICssStyleCollector, IThemeService } from 'vs/platform/theme/common/themeService';
import { IWindowService, MenuBarVisibility, IWindowsService, getTitleBarStyle, URIType } from 'vs/platform/windows/common/windows';
import { IWindowService, MenuBarVisibility, IWindowsService, getTitleBarStyle, IURIToOpen } from 'vs/platform/windows/common/windows';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IAction, Action } from 'vs/base/common/actions';
import { Separator } from 'vs/base/browser/ui/actionbar/actionbar';
@@ -355,36 +355,35 @@ export class MenubarControl extends Disposable {
return label;
}
private createOpenRecentMenuAction(recent: IRecent, isFile: boolean): IAction & { uri: URI } {
private createOpenRecentMenuAction(recent: IRecent): IAction & { uri: URI } {
let label: string;
let uri: URI;
let commandId: string;
let typeHint: URIType | undefined;
let uriToOpen: IURIToOpen;
if (isRecentFolder(recent)) {
uri = recent.folderUri;
label = recent.label || this.labelService.getWorkspaceLabel(uri, { verbose: true });
commandId = 'openRecentFolder';
typeHint = 'folder';
uriToOpen = { folderUri: uri };
} else if (isRecentWorkspace(recent)) {
uri = recent.workspace.configPath;
label = recent.label || this.labelService.getWorkspaceLabel(recent.workspace, { verbose: true });
commandId = 'openRecentWorkspace';
typeHint = 'file';
uriToOpen = { workspaceUri: uri };
} else {
uri = recent.fileUri;
label = recent.label || this.labelService.getUriLabel(uri);
commandId = 'openRecentFile';
typeHint = 'file';
uriToOpen = { fileUri: uri };
}
const ret: IAction = new Action(commandId, unmnemonicLabel(label), undefined, undefined, (event) => {
const openInNewWindow = event && ((!isMacintosh && (event.ctrlKey || event.shiftKey)) || (isMacintosh && (event.metaKey || event.altKey)));
return this.windowService.openWindow([{ uri, typeHint }], {
forceNewWindow: openInNewWindow,
forceOpenWorkspaceAsFile: isFile
return this.windowService.openWindow([uriToOpen], {
forceNewWindow: openInNewWindow
});
});
@@ -403,7 +402,7 @@ export class MenubarControl extends Disposable {
if (workspaces.length > 0) {
for (let i = 0; i < MenubarControl.MAX_MENU_RECENT_ENTRIES && i < workspaces.length; i++) {
result.push(this.createOpenRecentMenuAction(workspaces[i], false));
result.push(this.createOpenRecentMenuAction(workspaces[i]));
}
result.push(new Separator());
@@ -411,7 +410,7 @@ export class MenubarControl extends Disposable {
if (files.length > 0) {
for (let i = 0; i < MenubarControl.MAX_MENU_RECENT_ENTRIES && i < files.length; i++) {
result.push(this.createOpenRecentMenuAction(files[i], true));
result.push(this.createOpenRecentMenuAction(files[i]));
}
result.push(new Separator());

View File

@@ -178,7 +178,7 @@ export abstract class ViewletPanel extends Panel implements IView {
return undefined;
}
getActionsContext(): any {
getActionsContext(): unknown {
return undefined;
}