Merge from vscode c58aaab8a1cc22a7139b761166a0d4f37d41e998 (#7880)

* Merge from vscode c58aaab8a1cc22a7139b761166a0d4f37d41e998

* fix pipelines

* fix strict-null-checks

* add missing files
This commit is contained in:
Anthony Dresser
2019-10-21 22:12:22 -07:00
committed by GitHub
parent 7c9be74970
commit 1e22f47304
913 changed files with 18898 additions and 16536 deletions

View File

@@ -113,7 +113,7 @@ export function extractResources(e: DragEvent, externalOnly?: boolean): Array<ID
if (e.dataTransfer && e.dataTransfer.files) {
for (let i = 0; i < e.dataTransfer.files.length; i++) {
const file = e.dataTransfer.files[i];
if (file && file.path /* Electron only */ && !resources.some(r => r.resource.fsPath === file.path) /* prevent duplicates */) {
if (file?.path /* Electron only */ && !resources.some(r => r.resource.fsPath === file.path) /* prevent duplicates */) {
try {
resources.push({ resource: URI.file(file.path), isExternal: true });
} catch (error) {
@@ -243,11 +243,13 @@ export class ResourcesDropHandler {
}
// Resolve the contents of the dropped dirty resource from source
try {
const content = await this.backupFileService.resolveBackupContent((droppedDirtyEditor.backupResource!));
await this.backupFileService.backupResource(droppedDirtyEditor.resource, content.value.create(this.getDefaultEOL()).createSnapshot(true));
} catch (e) {
// Ignore error
if (droppedDirtyEditor.backupResource) {
try {
const content = await this.backupFileService.resolveBackupContent((droppedDirtyEditor.backupResource));
await this.backupFileService.backupResource(droppedDirtyEditor.resource, content.value.create(this.getDefaultEOL()).createSnapshot(true));
} catch (e) {
// Ignore error
}
}
return false;
@@ -358,7 +360,7 @@ export function fillResourceDataTransfers(accessor: ServicesAccessor, resources:
for (const textEditorWidget of textEditorWidgets) {
if (isCodeEditor(textEditorWidget)) {
const model = textEditorWidget.getModel();
if (model && model.uri && model.uri.toString() === file.resource.toString()) {
if (model?.uri?.toString() === file.resource.toString()) {
viewState = textEditorWidget.saveViewState();
break;
}