Skip to content

Commit

Permalink
debt - a bit more strict init
Browse files Browse the repository at this point in the history
  • Loading branch information
bpasero committed Sep 16, 2019
1 parent d157c2e commit b644486
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 29 deletions.
2 changes: 1 addition & 1 deletion src/vs/code/browser/workbench/workbench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class LocalStorageCredentialsProvider implements ICredentialsProvider {

static readonly CREDENTIALS_OPENED_KEY = 'credentials.provider';

private _credentials: ICredential[];
private _credentials!: ICredential[];
private get credentials(): ICredential[] {
if (!this._credentials) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class LifecycleService extends AbstractLifecycleService {

_serviceBrand: undefined;

private shutdownReason: ShutdownReason;
private shutdownReason: ShutdownReason | undefined;

constructor(
@INotificationService private readonly notificationService: INotificationService,
Expand Down
4 changes: 2 additions & 2 deletions src/vs/platform/workspace/common/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export interface IWorkspaceFolder extends IWorkspaceFolderData {
export class Workspace implements IWorkspace {

private _foldersMap: TernarySearchTree<WorkspaceFolder> = TernarySearchTree.forPaths<WorkspaceFolder>();
private _folders: WorkspaceFolder[];
private _folders!: WorkspaceFolder[];

constructor(
private _id: string,
Expand Down Expand Up @@ -265,4 +265,4 @@ export function toWorkspaceFolders(configuredFolders: IStoredWorkspaceFolder[],
}
}
return result;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import * as pfs from 'vs/base/node/pfs';
import { EnvironmentService } from 'vs/platform/environment/node/environmentService';
import { parseArgs, OPTIONS } from 'vs/platform/environment/node/argv';
import { WorkspacesMainService, IStoredWorkspace } from 'vs/platform/workspaces/electron-main/workspacesMainService';
import { WORKSPACE_EXTENSION, IWorkspaceIdentifier, IRawFileWorkspaceFolder, IWorkspaceFolderCreationData, IRawUriWorkspaceFolder, rewriteWorkspaceFileForNewLocation } from 'vs/platform/workspaces/common/workspaces';
import { WORKSPACE_EXTENSION, IRawFileWorkspaceFolder, IWorkspaceFolderCreationData, IRawUriWorkspaceFolder, rewriteWorkspaceFileForNewLocation } from 'vs/platform/workspaces/common/workspaces';
import { NullLogService } from 'vs/platform/log/common/log';
import { URI } from 'vs/base/common/uri';
import { getRandomTestPath } from 'vs/base/test/node/testUtils';
Expand All @@ -29,16 +29,6 @@ suite('WorkspacesMainService', () => {
}
}

class TestWorkspacesMainService extends WorkspacesMainService {
public deleteWorkspaceCall: IWorkspaceIdentifier;

public deleteUntitledWorkspaceSync(workspace: IWorkspaceIdentifier): void {
this.deleteWorkspaceCall = workspace;

super.deleteUntitledWorkspaceSync(workspace);
}
}

function createWorkspace(folders: string[], names?: string[]) {
return service.createUntitledWorkspace(folders.map((folder, index) => ({ uri: URI.file(folder), name: names ? names[index] : undefined } as IWorkspaceFolderCreationData)));
}
Expand All @@ -50,10 +40,10 @@ suite('WorkspacesMainService', () => {
const environmentService = new TestEnvironmentService(parseArgs(process.argv, OPTIONS), process.execPath);
const logService = new NullLogService();

let service: TestWorkspacesMainService;
let service: WorkspacesMainService;

setup(async () => {
service = new TestWorkspacesMainService(environmentService, logService);
service = new WorkspacesMainService(environmentService, logService);

// Delete any existing backups completely and then re-create it.
await pfs.rimraf(untitledWorkspacesHomePath, pfs.RimRafMode.MOVE);
Expand Down
18 changes: 9 additions & 9 deletions src/vs/workbench/browser/legacyLayout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,20 @@ export class WorkbenchLegacyLayout extends Disposable implements IVerticalSashLa
private static readonly sashYHeightSettingsKey = 'workbench.panel.height';
private static readonly panelSizeBeforeMaximizedKey = 'workbench.panel.sizeBeforeMaximized';

private workbenchSize: Dimension;
private workbenchSize!: Dimension;

private sashXOne: Sash;
private sashXTwo: Sash;
private sashY: Sash;

private _sidebarWidth: number;
private sidebarHeight: number;
private titlebarHeight: number;
private statusbarHeight: number;
private panelSizeBeforeMaximized: number;
private panelMaximized: boolean;
private _panelHeight: number;
private _panelWidth: number;
private _sidebarWidth!: number;
private sidebarHeight!: number;
private titlebarHeight!: number;
private statusbarHeight!: number;
private panelSizeBeforeMaximized!: number;
private panelMaximized!: boolean;
private _panelHeight!: number;
private _panelWidth!: number;

constructor(
private parent: HTMLElement,
Expand Down
4 changes: 2 additions & 2 deletions src/vs/workbench/contrib/remote/browser/remote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class HelpDataSource implements IAsyncDataSource<any, any> {
}

getChildren(element: any) {
if (element instanceof HelpModel) {
if (element instanceof HelpModel && element.items) {
return element.items;
}

Expand Down Expand Up @@ -201,7 +201,7 @@ class IssueReporterItem implements IHelpItem {
}

class HelpModel {
items: IHelpItem[];
items: IHelpItem[] | undefined;

constructor(
viewModel: IViewModel,
Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/contrib/watermark/browser/watermark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const folderEntries = [
const WORKBENCH_TIPS_ENABLED_KEY = 'workbench.tips.enabled';

export class WatermarkContribution extends Disposable implements IWorkbenchContribution {
private watermark: HTMLElement;
private watermark: HTMLElement | undefined;
private watermarkDisposable = this._register(new DisposableStore());
private enabled: boolean;
private workbenchState: WorkbenchState;
Expand Down

0 comments on commit b644486

Please sign in to comment.