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

@@ -17,14 +17,14 @@ export class ActionBarContributor {
/**
* Returns true if this contributor has actions for the given context.
*/
hasActions(context: any): boolean {
hasActions(context: unknown): boolean {
return false;
}
/**
* Returns an array of primary actions in the given context.
*/
getActions(context: any): IAction[] {
getActions(context: unknown): IAction[] {
return [];
}
}
@@ -46,14 +46,14 @@ export const Scope = {
export class ContributableActionProvider implements IActionProvider {
private readonly registry: IActionBarRegistry = Registry.as<IActionBarRegistry>(Extensions.Actionbar);
private toContext(tree: ITree, element: any): any {
private toContext(tree: ITree, element: unknown): unknown {
return {
viewer: tree,
element: element
};
}
hasActions(tree: ITree, element: any): boolean {
hasActions(tree: ITree, element: unknown): boolean {
const context = this.toContext(tree, element);
const contributors = this.registry.getActionBarContributors(Scope.VIEWER);
@@ -66,7 +66,7 @@ export class ContributableActionProvider implements IActionProvider {
return false;
}
getActions(tree: ITree, element: any): IAction[] {
getActions(tree: ITree, element: unknown): IAction[] {
const actions: IAction[] = [];
const context = this.toContext(tree, element);

View File

@@ -233,12 +233,10 @@ export class ToggleEditorVisibilityAction extends Action {
return Promise.resolve();
}
}
registry.registerWorkbenchAction(new SyncActionDescriptor(ToggleEditorVisibilityAction, ToggleEditorVisibilityAction.ID, ToggleEditorVisibilityAction.LABEL), 'View: Toggle Editor Area Visibility', viewCategory, ContextKeyExpr.equals('config.workbench.useExperimentalGridLayout', true));
export class ToggleSidebarVisibilityAction extends Action {
static readonly ID = 'workbench.action.toggleSidebarVisibility';

View File

@@ -80,7 +80,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
handler: (accessor, arg2) => focusDown(accessor, arg2)
});
function expandMultiSelection(focused: List<any> | PagedList<any> | ITree | ObjectTree<any, any> | DataTree<any, any, any> | AsyncDataTree<any, any, any>, previousFocus: any): void {
function expandMultiSelection(focused: List<unknown> | PagedList<unknown> | ITree | ObjectTree<unknown, unknown> | DataTree<unknown, unknown, unknown> | AsyncDataTree<unknown, unknown, unknown>, previousFocus: unknown): void {
// List
if (focused instanceof List || focused instanceof PagedList) {
@@ -625,7 +625,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
const selection = tree.getSelection();
// Which element should be considered to start selecting all?
let start: any | undefined = undefined;
let start: unknown | undefined = undefined;
if (focus.length > 0 && (selection.length === 0 || selection.indexOf(focus[0]) === -1)) {
start = focus[0];
@@ -636,7 +636,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
}
// What is the scope of select all?
let scope: any | undefined = undefined;
let scope: unknown | undefined = undefined;
if (!start) {
scope = undefined;
@@ -651,8 +651,8 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
}
}
const newSelection: any[] = [];
const visit = (node: ITreeNode<any, any>) => {
const newSelection: unknown[] = [];
const visit = (node: ITreeNode<unknown, unknown>) => {
for (const child of node.children) {
if (child.visible) {
newSelection.push(child.element);

View File

@@ -300,7 +300,7 @@ export class DuplicateWorkspaceInNewWindowAction extends Action {
return this.workspacesService.createUntitledWorkspace(folders, remoteAuthority).then(newWorkspace => {
return this.workspaceEditingService.copyWorkspaceSettings(newWorkspace).then(() => {
return this.windowService.openWindow([{ uri: newWorkspace.configPath, typeHint: 'file' }], { forceNewWindow: true });
return this.windowService.openWindow([{ workspaceUri: newWorkspace.configPath }], { forceNewWindow: true });
});
});
}

View File

@@ -89,13 +89,13 @@ CommandsRegistry.registerCommand(PICK_WORKSPACE_FOLDER_COMMAND_ID, function (acc
return undefined;
}
const folderPicks = folders.map(folder => {
const folderPicks: IQuickPickItem[] = folders.map(folder => {
return {
label: folder.name,
description: labelService.getUriLabel(resources.dirname(folder.uri), { relative: true }),
folder,
iconClasses: getIconClasses(modelService, modeService, folder.uri, FileKind.ROOT_FOLDER)
} as IQuickPickItem;
};
});
const options: IPickOptions<IQuickPickItem> = (args ? args[0] : undefined) || Object.create(null);

View File

@@ -176,7 +176,7 @@ export abstract class Composite extends Component implements IComposite {
/**
* Provide a context to be passed to the toolbar.
*/
getActionsContext(): any {
getActionsContext(): unknown {
return null;
}
@@ -210,10 +210,10 @@ export abstract class Composite extends Component implements IComposite {
}
/**
* Returns the underlying composite control or null if it is not accessible.
* Returns the underlying composite control or `undefined` if it is not accessible.
*/
getControl(): ICompositeControl | null {
return null;
getControl(): ICompositeControl | undefined {
return undefined;
}
}
@@ -257,7 +257,7 @@ export abstract class CompositeRegistry<T extends Composite> extends Disposable
protected deregisterComposite(id: string): void {
const descriptor = this.compositeById(id);
if (descriptor === null) {
if (!descriptor) {
return;
}

View File

@@ -7,7 +7,7 @@ import { Event } from 'vs/base/common/event';
import { Disposable } from 'vs/base/common/lifecycle';
import { IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey';
import { InputFocusedContext } from 'vs/platform/contextkey/common/contextkeys';
import { IWindowConfiguration, IWindowService } from 'vs/platform/windows/common/windows';
import { IWindowService, IWindowsConfiguration } from 'vs/platform/windows/common/windows';
import { ActiveEditorContext, EditorsVisibleContext, TextCompareEditorVisibleContext, TextCompareEditorActiveContext, ActiveEditorGroupEmptyContext, MultipleEditorGroupsContext, TEXT_DIFF_EDITOR_ID, SplitEditorsVertically, InEditorZenModeContext } from 'vs/workbench/common/editor';
import { IsMacContext, IsLinuxContext, IsWindowsContext, HasMacNativeTabsContext, IsDevelopmentContext, SupportsWorkspacesContext, SupportsOpenFileFolderContext, WorkbenchStateContext, WorkspaceFolderCountContext, IsRemoteContext } from 'vs/workbench/common/contextkeys';
import { trackFocus, addDisposableListener, EventType } from 'vs/base/browser/dom';
@@ -16,7 +16,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { WorkbenchState, IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { SidebarVisibleContext, SideBarVisibleContext } from 'vs/workbench/common/viewlet';
import { SideBarVisibleContext } from 'vs/workbench/common/viewlet';
import { IWorkbenchLayoutService, Parts } from 'vs/workbench/services/layout/browser/layoutService';
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
@@ -38,8 +38,6 @@ export class WorkbenchContextKeysHandler extends Disposable {
private inZenModeContext: IContextKey<boolean>;
private sideBarVisibleContext: IContextKey<boolean>;
//TODO@Isidor remove in May
private sidebarVisibleContext: IContextKey<boolean>;
constructor(
@IContextKeyService private contextKeyService: IContextKeyService,
@@ -93,7 +91,7 @@ export class WorkbenchContextKeysHandler extends Disposable {
IsRemoteContext.bindTo(this.contextKeyService).set(!!this.windowService.getConfiguration().remoteAuthority);
// macOS Native Tabs
const windowConfig = this.configurationService.getValue<IWindowConfiguration>();
const windowConfig = this.configurationService.getValue<IWindowsConfiguration>();
HasMacNativeTabsContext.bindTo(this.contextKeyService).set(windowConfig && windowConfig.window && windowConfig.window.nativeTabs);
// Development
@@ -131,7 +129,6 @@ export class WorkbenchContextKeysHandler extends Disposable {
// Sidebar
this.sideBarVisibleContext = SideBarVisibleContext.bindTo(this.contextKeyService);
this.sidebarVisibleContext = SidebarVisibleContext.bindTo(this.contextKeyService);
}
private updateEditorContextKeys(): void {
@@ -208,6 +205,5 @@ export class WorkbenchContextKeysHandler extends Disposable {
private updateSideBarContextKeys(): void {
this.sideBarVisibleContext.set(this.layoutService.isVisible(Parts.SIDEBAR_PART));
this.sidebarVisibleContext.set(this.layoutService.isVisible(Parts.SIDEBAR_PART));
}
}

View File

@@ -3,7 +3,7 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { hasWorkspaceFileExtension } from 'vs/platform/workspaces/common/workspaces';
import { hasWorkspaceFileExtension, IWorkspaceFolderCreationData } from 'vs/platform/workspaces/common/workspaces';
import { normalize } from 'vs/base/common/path';
import { basename } from 'vs/base/common/resources';
import { IFileService } from 'vs/platform/files/common/files';
@@ -79,7 +79,7 @@ export function extractResources(e: DragEvent, externalOnly?: boolean): Array<ID
const rawEditorsData = e.dataTransfer.getData(CodeDataTransfers.EDITORS);
if (rawEditorsData) {
try {
const draggedEditors = JSON.parse(rawEditorsData) as ISerializedDraggedEditor[];
const draggedEditors: ISerializedDraggedEditor[] = JSON.parse(rawEditorsData);
draggedEditors.forEach(draggedEditor => {
resources.push({ resource: URI.parse(draggedEditor.resource), backupResource: draggedEditor.backupResource ? URI.parse(draggedEditor.backupResource) : undefined, viewState: draggedEditor.viewState, isExternal: false });
});
@@ -105,7 +105,7 @@ export function extractResources(e: DragEvent, externalOnly?: boolean): Array<ID
// Check for native file transfer
if (e.dataTransfer && e.dataTransfer.files) {
for (let i = 0; i < e.dataTransfer.files.length; i++) {
const file = e.dataTransfer.files[i] as { path: string };
const file = e.dataTransfer.files[i];
if (file && file.path && !resources.some(r => r.resource.fsPath === file.path) /* prevent duplicates */) {
try {
resources.push({ resource: URI.file(file.path), isExternal: true });
@@ -120,7 +120,7 @@ export function extractResources(e: DragEvent, externalOnly?: boolean): Array<ID
const rawCodeFiles = e.dataTransfer.getData(CodeDataTransfers.FILES);
if (rawCodeFiles) {
try {
const codeFiles = JSON.parse(rawCodeFiles) as string[];
const codeFiles: string[] = JSON.parse(rawCodeFiles);
codeFiles.forEach(codeFile => {
if (!resources.some(r => r.resource.fsPath === codeFile) /* prevent duplicates */) {
resources.push({ resource: URI.file(codeFile), isExternal: true });
@@ -254,16 +254,14 @@ export class ResourcesDropHandler {
}
private handleWorkspaceFileDrop(fileOnDiskResources: URI[]): Promise<boolean> {
const workspaceResources: { workspaces: IURIToOpen[], folders: IURIToOpen[] } = {
workspaces: [],
folders: []
};
const urisToOpen: IURIToOpen[] = [];
const folderURIs: IWorkspaceFolderCreationData[] = [];
return Promise.all(fileOnDiskResources.map(fileOnDiskResource => {
// Check for Workspace
if (hasWorkspaceFileExtension(fileOnDiskResource.fsPath)) {
workspaceResources.workspaces.push({ uri: fileOnDiskResource, typeHint: 'file' });
urisToOpen.push({ workspaceUri: fileOnDiskResource });
return undefined;
}
@@ -271,14 +269,14 @@ export class ResourcesDropHandler {
// Check for Folder
return this.fileService.resolve(fileOnDiskResource).then(stat => {
if (stat.isDirectory) {
workspaceResources.folders.push({ uri: stat.resource, typeHint: 'folder' });
urisToOpen.push({ folderUri: stat.resource });
folderURIs.push({ uri: stat.resource });
}
}, error => undefined);
})).then(_ => {
const { workspaces, folders } = workspaceResources;
// Return early if no external resource is a folder or workspace
if (workspaces.length === 0 && folders.length === 0) {
if (urisToOpen.length === 0) {
return false;
}
@@ -286,12 +284,12 @@ export class ResourcesDropHandler {
this.windowService.focusWindow();
// Open in separate windows if we drop workspaces or just one folder
if (workspaces.length > 0 || folders.length === 1) {
return this.windowService.openWindow([...workspaces, ...folders], { forceReuseWindow: true }).then(_ => true);
if (urisToOpen.length > folderURIs.length || folderURIs.length === 1) {
return this.windowService.openWindow(urisToOpen, { forceReuseWindow: true }).then(_ => true);
}
// folders.length > 1: Multiple folders: Create new workspace with folders and open
return this.workspaceEditingService.createAndEnterWorkspace(folders).then(_ => true);
return this.workspaceEditingService.createAndEnterWorkspace(folderURIs).then(_ => true);
});
}
}

View File

@@ -16,7 +16,7 @@ export interface IEditorDescriptor {
getId(): string;
getName(): string;
describes(obj: any): boolean;
describes(obj: unknown): boolean;
}
export interface IEditorRegistry {
@@ -76,7 +76,7 @@ export class EditorDescriptor implements IEditorDescriptor {
return this.name;
}
describes(obj: any): boolean {
describes(obj: unknown): boolean {
return obj instanceof BaseEditor && (<BaseEditor>obj).getId() === this.id;
}
}
@@ -88,7 +88,7 @@ class EditorRegistry implements IEditorRegistry {
registerEditor(descriptor: EditorDescriptor, editorInputDescriptor: SyncDescriptor<EditorInput>): void;
registerEditor(descriptor: EditorDescriptor, editorInputDescriptor: SyncDescriptor<EditorInput>[]): void;
registerEditor(descriptor: EditorDescriptor, editorInputDescriptor: any): void {
registerEditor(descriptor: EditorDescriptor, editorInputDescriptor: SyncDescriptor<EditorInput> | SyncDescriptor<EditorInput>[]): void {
// Support both non-array and array parameter
let inputDescriptors: SyncDescriptor<EditorInput>[] = [];

View File

@@ -3,7 +3,7 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { URI as uri } from 'vs/base/common/uri';
import { URI } from 'vs/base/common/uri';
import * as resources from 'vs/base/common/resources';
import { IconLabel, IIconLabelValueOptions, IIconLabelCreationOptions } from 'vs/base/browser/ui/iconLabel/iconLabel';
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
@@ -27,7 +27,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import { withNullAsUndefined } from 'vs/base/common/types';
export interface IResourceLabelProps {
resource?: uri;
resource?: URI;
name?: string;
description?: string;
}
@@ -61,7 +61,7 @@ export interface IResourceLabel extends IDisposable {
/**
* Convinient method to render a file label based on a resource.
*/
setFile(resource: uri, options?: IFileLabelOptions): void;
setFile(resource: URI, options?: IFileLabelOptions): void;
/**
* Convinient method to apply a label by passing an editor along.
@@ -151,7 +151,7 @@ export class ResourceLabels extends Disposable {
setLabel: (label?: string, description?: string, options?: IIconLabelValueOptions) => widget.setLabel(label, description, options),
setResource: (label: IResourceLabelProps, options?: IResourceLabelOptions) => widget.setResource(label, options),
setEditor: (editor: IEditorInput, options?: IResourceLabelOptions) => widget.setEditor(editor, options),
setFile: (resource: uri, options?: IFileLabelOptions) => widget.setFile(resource, options),
setFile: (resource: URI, options?: IFileLabelOptions) => widget.setFile(resource, options),
clear: () => widget.clear(),
dispose: () => this.disposeWidget(widget)
};
@@ -338,7 +338,7 @@ class ResourceLabelWidget extends IconLabel {
}, options);
}
setFile(resource: uri, options?: IFileLabelOptions): void {
setFile(resource: URI, options?: IFileLabelOptions): void {
const hideLabel = options && options.hideLabel;
let name: string | undefined;
if (!hideLabel) {

View File

@@ -457,9 +457,9 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
let input: IResourceInput | IUntitledResourceInput;
if (isNew) {
input = { filePath: resource.fsPath, options: { pinned: true } } as IUntitledResourceInput;
input = { filePath: resource.fsPath, options: { pinned: true } };
} else {
input = { resource, options: { pinned: true }, forceFile: true } as IResourceInput;
input = { resource, options: { pinned: true }, forceFile: true };
}
if (!isNew && typeof p.lineNumber === 'number') {

View File

@@ -669,6 +669,8 @@ export class SimpleRemoteAuthorityResolverService implements IRemoteAuthorityRes
return Promise.resolve(undefined);
}
clearResolvedAuthority(authority: string): void { }
setResolvedAuthority(resolvedAuthority: ResolvedAuthority): void { }
setResolvedAuthorityError(authority: string, err: any): void { }
@@ -694,6 +696,7 @@ export class SimpleRemoteFileService implements IFileService {
readonly onAfterOperation = Event.None;
readonly onDidChangeFileSystemProviderRegistrations = Event.None;
readonly onWillActivateFileSystemProvider = Event.None;
readonly onError = Event.None;
resolve(resource: URI, options?: IResolveFileOptions): Promise<IFileStatWithMetadata> {
// @ts-ignore
@@ -798,13 +801,11 @@ export class SimpleRemoteFileService implements IFileService {
canHandleResource(resource: URI): boolean { return resource.scheme === 'file'; }
hasCapability(resource: URI, capability: FileSystemProviderCapabilities): Promise<boolean> { return Promise.resolve(false); }
hasCapability(resource: URI, capability: FileSystemProviderCapabilities): boolean { return false; }
del(_resource: URI, _options?: { useTrash?: boolean, recursive?: boolean }): Promise<void> { return Promise.resolve(); }
watch(_resource: URI): void { }
unwatch(_resource: URI): void { }
watch(_resource: URI): IDisposable { return Disposable.None; }
getWriteEncoding(_resource: URI): IResourceEncoding { return { encoding: 'utf8', hasBOM: false }; }

View File

@@ -45,7 +45,7 @@ export class PanelRegistry extends CompositeRegistry<Panel> {
* Returns an array of registered panels known to the platform.
*/
getPanels(): PanelDescriptor[] {
return this.getComposites() as PanelDescriptor[];
return this.getComposites();
}
/**

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;
}

View File

@@ -138,7 +138,7 @@ export class QuickOpenHandlerDescriptor {
constructor(ctor: IConstructorSignature0<QuickOpenHandler>, id: string, prefix: string, contextKey: string | undefined, description: string, instantProgress?: boolean);
constructor(ctor: IConstructorSignature0<QuickOpenHandler>, id: string, prefix: string, contextKey: string | undefined, helpEntries: QuickOpenHandlerHelpEntry[], instantProgress?: boolean);
constructor(ctor: IConstructorSignature0<QuickOpenHandler>, id: string, prefix: string, contextKey: string | undefined, param: any, instantProgress: boolean = false) {
constructor(ctor: IConstructorSignature0<QuickOpenHandler>, id: string, prefix: string, contextKey: string | undefined, param: string | QuickOpenHandlerHelpEntry[], instantProgress: boolean = false) {
this.ctor = ctor;
this.id = id;
this.prefix = prefix;
@@ -325,7 +325,7 @@ export class QuickOpenAction extends Action {
this.enabled = !!this.quickOpenService;
}
run(context?: any): Promise<void> {
run(): Promise<void> {
// Show with prefix
this.quickOpenService.show(this.prefix);

View File

@@ -93,7 +93,7 @@ export class Workbench extends Layout {
}
private previousUnexpectedError: { message: string | undefined, time: number } = { message: undefined, time: 0 };
private handleUnexpectedError(error: any, logService: ILogService): void {
private handleUnexpectedError(error: unknown, logService: ILogService): void {
const message = toErrorMessage(error, true);
if (!message) {
return;