提交 0a9ef2ad 编写于 作者: B Benjamin Pasero

code 💄

上级 95161e0f
......@@ -309,7 +309,7 @@ export class WindowsManager extends Disposable implements IWindowsMainService {
if (!currentWindowsState.lastActiveWindow) {
let activeWindow = this.getLastActiveWindow();
if (!activeWindow || activeWindow.isExtensionDevelopmentHost) {
activeWindow = WindowsManager.WINDOWS.filter(w => !w.isExtensionDevelopmentHost)[0];
activeWindow = WindowsManager.WINDOWS.filter(window => !window.isExtensionDevelopmentHost)[0];
}
if (activeWindow) {
......@@ -318,7 +318,7 @@ export class WindowsManager extends Disposable implements IWindowsMainService {
}
// 2.) Find extension host window
const extensionHostWindow = WindowsManager.WINDOWS.filter(w => w.isExtensionDevelopmentHost && !w.isExtensionTestHost)[0];
const extensionHostWindow = WindowsManager.WINDOWS.filter(window => window.isExtensionDevelopmentHost && !window.isExtensionTestHost)[0];
if (extensionHostWindow) {
currentWindowsState.lastPluginDevelopmentHostWindow = this.toWindowState(extensionHostWindow);
}
......@@ -329,7 +329,7 @@ export class WindowsManager extends Disposable implements IWindowsMainService {
// so if we ever want to persist the UI state of the last closed window (window count === 1), it has
// to come from the stored lastClosedWindowState on Win/Linux at least
if (this.getWindowCount() > 1) {
currentWindowsState.openedWindows = WindowsManager.WINDOWS.filter(w => !w.isExtensionDevelopmentHost).map(w => this.toWindowState(w));
currentWindowsState.openedWindows = WindowsManager.WINDOWS.filter(window => !window.isExtensionDevelopmentHost).map(window => this.toWindowState(window));
}
// Persist
......@@ -456,7 +456,7 @@ export class WindowsManager extends Disposable implements IWindowsMainService {
// 1.) focus last active window if we are not instructed to open any paths
if (focusLastActive) {
const lastActiveWindow = usedWindows.filter(w => w.backupPath === this.windowsState.lastActiveWindow!.backupPath);
const lastActiveWindow = usedWindows.filter(window => window.backupPath === this.windowsState.lastActiveWindow!.backupPath);
if (lastActiveWindow.length) {
lastActiveWindow[0].focus();
focusLastOpened = false;
......@@ -490,7 +490,7 @@ export class WindowsManager extends Disposable implements IWindowsMainService {
// Remember in recent document list (unless this opens for extension development)
// Also do not add paths when files are opened for diffing, only if opened individually
if (!usedWindows.some(w => w.isExtensionDevelopmentHost) && !openConfig.diffMode && !openConfig.noRecentEntry) {
if (!usedWindows.some(window => window.isExtensionDevelopmentHost) && !openConfig.diffMode && !openConfig.noRecentEntry) {
const recents: IRecent[] = [];
for (let pathToOpen of pathsToOpen) {
if (pathToOpen.workspace) {
......@@ -556,7 +556,7 @@ export class WindowsManager extends Disposable implements IWindowsMainService {
const fileToCheck = fileInputs.filesToOpenOrCreate[0] || fileInputs.filesToDiff[0];
// only look at the windows with correct authority
const windows = WindowsManager.WINDOWS.filter(w => w.remoteAuthority === fileInputs!.remoteAuthority);
const windows = WindowsManager.WINDOWS.filter(window => window.remoteAuthority === fileInputs!.remoteAuthority);
const bestWindowOrFolder = findBestWindowOrFolderForFile({
windows,
......@@ -1599,7 +1599,7 @@ export class WindowsManager extends Disposable implements IWindowsMainService {
}
getLastActiveWindowForAuthority(remoteAuthority: string | undefined): ICodeWindow | undefined {
return getLastActiveWindow(WindowsManager.WINDOWS.filter(w => w.remoteAuthority === remoteAuthority));
return getLastActiveWindow(WindowsManager.WINDOWS.filter(window => window.remoteAuthority === remoteAuthority));
}
openNewWindow(context: OpenContext, options?: INewWindowOptions): ICodeWindow[] {
......@@ -1642,13 +1642,13 @@ export class WindowsManager extends Disposable implements IWindowsMainService {
}
sendToAll(channel: string, payload?: any, windowIdsToIgnore?: number[]): void {
WindowsManager.WINDOWS.forEach(w => {
if (windowIdsToIgnore && windowIdsToIgnore.indexOf(w.id) >= 0) {
return; // do not send if we are instructed to ignore it
for (const window of WindowsManager.WINDOWS) {
if (windowIdsToIgnore && windowIdsToIgnore.indexOf(window.id) >= 0) {
continue; // do not send if we are instructed to ignore it
}
w.sendWhenReady(channel, payload);
});
window.sendWhenReady(channel, payload);
}
}
getFocusedWindow(): ICodeWindow | undefined {
......@@ -1661,7 +1661,7 @@ export class WindowsManager extends Disposable implements IWindowsMainService {
}
getWindowById(windowId: number): ICodeWindow | undefined {
const res = WindowsManager.WINDOWS.filter(w => w.id === windowId);
const res = WindowsManager.WINDOWS.filter(window => window.id === windowId);
if (res && res.length === 1) {
return res[0];
}
......
......@@ -138,7 +138,7 @@ export class BackupMainService implements IBackupMainService {
}
registerWorkspaceBackupSync(workspaceInfo: IWorkspaceBackupInfo, migrateFrom?: string): string {
if (!this.rootWorkspaces.some(w => workspaceInfo.workspace.id === w.workspace.id)) {
if (!this.rootWorkspaces.some(window => workspaceInfo.workspace.id === window.workspace.id)) {
this.rootWorkspaces.push(workspaceInfo);
this.saveSync();
}
......@@ -219,7 +219,7 @@ export class BackupMainService implements IBackupMainService {
backupFolder = this.getRandomEmptyWindowId();
}
if (!this.emptyWorkspaces.some(w => !!w.backupFolder && isEqual(w.backupFolder, backupFolder!, !platform.isLinux))) {
if (!this.emptyWorkspaces.some(window => !!window.backupFolder && isEqual(window.backupFolder, backupFolder!, !platform.isLinux))) {
this.emptyWorkspaces.push({ backupFolder, remoteAuthority });
this.saveSync();
}
......@@ -353,7 +353,7 @@ export class BackupMainService implements IBackupMainService {
// New empty window backup
let newBackupFolder = this.getRandomEmptyWindowId();
while (this.emptyWorkspaces.some(w => !!w.backupFolder && isEqual(w.backupFolder, newBackupFolder, platform.isLinux))) {
while (this.emptyWorkspaces.some(window => !!window.backupFolder && isEqual(window.backupFolder, newBackupFolder, platform.isLinux))) {
newBackupFolder = this.getRandomEmptyWindowId();
}
......@@ -374,7 +374,7 @@ export class BackupMainService implements IBackupMainService {
// New empty window backup
let newBackupFolder = this.getRandomEmptyWindowId();
while (this.emptyWorkspaces.some(w => !!w.backupFolder && isEqual(w.backupFolder, newBackupFolder, platform.isLinux))) {
while (this.emptyWorkspaces.some(window => !!window.backupFolder && isEqual(window.backupFolder, newBackupFolder, platform.isLinux))) {
newBackupFolder = this.getRandomEmptyWindowId();
}
......@@ -457,4 +457,4 @@ export class BackupMainService implements IBackupMainService {
protected getLegacyFolderHash(folderPath: string): string {
return crypto.createHash('md5').update(platform.isLinux ? folderPath : folderPath.toLowerCase()).digest('hex');
}
}
\ No newline at end of file
}
......@@ -322,7 +322,7 @@ suite('BackupMainService', () => {
assert.deepEqual(json.folderURIWorkspaces, [URI.file(folderPath).toString()]);
assert.deepEqual(json.rootURIWorkspaces, [{ id: workspace.id, configURIPath: URI.file(workspacePath).toString() }]);
assertEqualUris(service.getWorkspaceBackups().map(w => w.workspace.configPath), [workspace.configPath]);
assertEqualUris(service.getWorkspaceBackups().map(window => window.workspace.configPath), [workspace.configPath]);
});
});
......@@ -731,4 +731,4 @@ suite('BackupMainService', () => {
}
});
});
});
\ No newline at end of file
});
......@@ -322,9 +322,14 @@ export class WindowsService extends Disposable implements IWindowsService, IURLH
this.logService.trace('windowsService#getWindows');
const windows = this.windowsMainService.getWindows();
const result = windows.map(w => ({ id: w.id, workspace: w.openedWorkspace, folderUri: w.openedFolderUri, title: w.win.getTitle(), filename: w.getRepresentedFilename() }));
return result;
return windows.map(window => ({
id: window.id,
workspace: window.openedWorkspace,
folderUri: window.openedFolderUri,
title: window.win.getTitle(),
filename: window.getRepresentedFilename()
}));
}
async getWindowCount(): Promise<number> {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册