Merge from vscode 2c306f762bf9c3db82dc06c7afaa56ef46d72f79 (#14050)

* Merge from vscode 2c306f762bf9c3db82dc06c7afaa56ef46d72f79

* Fix breaks

* Extension management fixes

* Fix breaks in windows bundling

* Fix/skip failing tests

* Update distro

* Add clear to nuget.config

* Add hygiene task

* Bump distro

* Fix hygiene issue

* Add build to hygiene exclusion

* Update distro

* Update hygiene

* Hygiene exclusions

* Update tsconfig

* Bump distro for server breaks

* Update build config

* Update darwin path

* Add done calls to notebook tests

* Skip failing tests

* Disable smoke tests
This commit is contained in:
Karl Burtram
2021-02-09 16:15:05 -08:00
committed by GitHub
parent 6f192f9af5
commit ce612a3d96
1929 changed files with 68012 additions and 34564 deletions

View File

@@ -5,22 +5,53 @@
import { IBackupFileService } from 'vs/workbench/services/backup/common/backup';
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
import { IFilesConfigurationService } from 'vs/workbench/services/filesConfiguration/common/filesConfigurationService';
import { IWorkingCopyService } from 'vs/workbench/services/workingCopy/common/workingCopyService';
import { ILifecycleService, ShutdownReason } from 'vs/platform/lifecycle/common/lifecycle';
import { AutoSaveMode, IFilesConfigurationService } from 'vs/workbench/services/filesConfiguration/common/filesConfigurationService';
import { IWorkingCopy, IWorkingCopyService, WorkingCopyCapabilities } from 'vs/workbench/services/workingCopy/common/workingCopyService';
import { ILifecycleService, ShutdownReason } from 'vs/workbench/services/lifecycle/common/lifecycle';
import { ILogService } from 'vs/platform/log/common/log';
import { BackupTracker } from 'vs/workbench/contrib/backup/common/backupTracker';
export class BrowserBackupTracker extends BackupTracker implements IWorkbenchContribution {
// Delay creation of backups when content changes to avoid too much
// load on the backup service when the user is typing into the editor
// Since we always schedule a backup, even when auto save is on (web
// only), we have different scheduling delays based on auto save. This
// helps to avoid a race between saving (after 1s per default) and making
// a backup of the working copy.
private static readonly BACKUP_SCHEDULE_DELAYS = {
[AutoSaveMode.OFF]: 1000,
[AutoSaveMode.ON_FOCUS_CHANGE]: 1000,
[AutoSaveMode.ON_WINDOW_CHANGE]: 1000,
[AutoSaveMode.AFTER_SHORT_DELAY]: 2000, // explicitly higher to prevent races
[AutoSaveMode.AFTER_LONG_DELAY]: 1000
};
constructor(
@IBackupFileService backupFileService: IBackupFileService,
@IFilesConfigurationService filesConfigurationService: IFilesConfigurationService,
@IFilesConfigurationService private readonly filesConfigurationService: IFilesConfigurationService,
@IWorkingCopyService workingCopyService: IWorkingCopyService,
@ILifecycleService lifecycleService: ILifecycleService,
@ILogService logService: ILogService
) {
super(backupFileService, filesConfigurationService, workingCopyService, logService, lifecycleService);
super(backupFileService, workingCopyService, logService, lifecycleService);
}
protected shouldScheduleBackup(workingCopy: IWorkingCopy): boolean {
// Web: we always want to schedule a backup, even if auto save
// is enabled because in web there is no handler on shutdown
// to trigger saving so there is a higher chance of dataloss.
// See https://github.com/microsoft/vscode/issues/108789
return true;
}
protected getBackupScheduleDelay(workingCopy: IWorkingCopy): number {
let autoSaveMode = this.filesConfigurationService.getAutoSaveMode();
if (workingCopy.capabilities & WorkingCopyCapabilities.Untitled) {
autoSaveMode = AutoSaveMode.OFF; // auto-save is never on for untitled working copies
}
return BrowserBackupTracker.BACKUP_SCHEDULE_DELAYS[autoSaveMode];
}
protected onBeforeShutdown(reason: ShutdownReason): boolean | Promise<boolean> {
@@ -41,7 +72,8 @@ export class BrowserBackupTracker extends BackupTracker implements IWorkbenchCon
for (const dirtyWorkingCopy of dirtyWorkingCopies) {
if (!this.backupFileService.hasBackupSync(dirtyWorkingCopy.resource, this.getContentVersion(dirtyWorkingCopy))) {
console.warn('Unload prevented: pending backups');
this.logService.warn('Unload veto: pending backups');
return true; // dirty without backup: veto
}
}