提交 eecec905 编写于 作者: P pi1024e

Revert "Fixed formatting"

This reverts commit ff8fc9aa75edd7d30d135ef49738754d421fa4fd.
上级 bc78d523
......@@ -34,9 +34,7 @@ export namespace ErrorEvent {
export function compare(a: ErrorEvent, b: ErrorEvent) {
if (a.callstack < b.callstack) {
return -1;
}
if (a.callstack > b.callstack) {
} else if (a.callstack > b.callstack) {
return 1;
}
return 0;
......@@ -77,21 +75,25 @@ export default abstract class BaseErrorTelemetry {
private _onErrorEvent(err: any): void {
if (err) {
// unwrap nested errors from loader
if (err.detail && err.detail.stack) {
err = err.detail;
}
if (!err) {
return;
}
// unwrap nested errors from loader
if (err.detail && err.detail.stack) {
err = err.detail;
}
// work around behavior in workerServer.ts that breaks up Error.stack
let callstack = Array.isArray(err.stack) ? err.stack.join('\n') : err.stack;
let msg = err.message ? err.message : safeStringify(err);
// work around behavior in workerServer.ts that breaks up Error.stack
let callstack = Array.isArray(err.stack) ? err.stack.join('\n') : err.stack;
let msg = err.message ? err.message : safeStringify(err);
// errors without a stack are not useful telemetry
if (callstack) {
this._enqueue({ msg, callstack });
}
// errors without a stack are not useful telemetry
if (!callstack) {
return;
}
this._enqueue({ msg, callstack });
}
protected _enqueue(e: ErrorEvent): void {
......@@ -100,10 +102,10 @@ export default abstract class BaseErrorTelemetry {
if (idx < 0) {
e.count = 1;
this._buffer.splice(~idx, 0, e);
} else if (!this._buffer[idx].count) {
this._buffer[idx].count = 0;
}
else {
} else {
if (!this._buffer[idx].count) {
this._buffer[idx].count = 0;
}
this._buffer[idx].count! += 1;
}
......
......@@ -332,7 +332,11 @@ export function findValidPasteFileTarget(targetFolder: ExplorerItem, fileToPaste
let name = resources.basenameOrAuthority(fileToPaste.resource);
let candidate = resources.joinPath(targetFolder.resource, name);
while (!(fileToPaste.allowOverwrite || targetFolder.root.find(candidate))) {
while (true && !fileToPaste.allowOverwrite) {
if (!targetFolder.root.find(candidate)) {
break;
}
name = incrementFileName(name, !!fileToPaste.isDirectory);
candidate = resources.joinPath(targetFolder.resource, name);
}
......@@ -947,42 +951,46 @@ export const deleteFileHandler = (accessor: ServicesAccessor) => {
let pasteShouldMove = false;
export const copyFileHandler = (accessor: ServicesAccessor) => {
const listService = accessor.get(IListService);
if (listService.lastFocusedList) {
const explorerContext = getContext(listService.lastFocusedList);
const explorerService = accessor.get(IExplorerService);
if (explorerContext.stat) {
const stats = explorerContext.selection.length > 1 ? explorerContext.selection : [explorerContext.stat];
explorerService.setToCopy(stats, false);
pasteShouldMove = false;
}
if (!listService.lastFocusedList) {
return;
}
const explorerContext = getContext(listService.lastFocusedList);
const explorerService = accessor.get(IExplorerService);
if (explorerContext.stat) {
const stats = explorerContext.selection.length > 1 ? explorerContext.selection : [explorerContext.stat];
explorerService.setToCopy(stats, false);
pasteShouldMove = false;
}
};
export const cutFileHandler = (accessor: ServicesAccessor) => {
const listService = accessor.get(IListService);
if (listService.lastFocusedList) {
const explorerContext = getContext(listService.lastFocusedList);
const explorerService = accessor.get(IExplorerService);
if (explorerContext.stat) {
const stats = explorerContext.selection.length > 1 ? explorerContext.selection : [explorerContext.stat];
explorerService.setToCopy(stats, true);
pasteShouldMove = true;
}
if (!listService.lastFocusedList) {
return;
}
const explorerContext = getContext(listService.lastFocusedList);
const explorerService = accessor.get(IExplorerService);
if (explorerContext.stat) {
const stats = explorerContext.selection.length > 1 ? explorerContext.selection : [explorerContext.stat];
explorerService.setToCopy(stats, true);
pasteShouldMove = true;
}
};
export const DOWNLOAD_COMMAND_ID = 'explorer.download';
const downloadFileHandler = (accessor: ServicesAccessor) => {
const listService = accessor.get(IListService);
if (listService.lastFocusedList) {
const explorerContext = getContext(listService.lastFocusedList);
const textFileService = accessor.get(ITextFileService);
if (explorerContext.stat) {
const stats = explorerContext.selection.length > 1 ? explorerContext.selection : [explorerContext.stat];
stats.forEach(async s => {
await textFileService.saveAs(s.resource, undefined, { availableFileSystems: [Schemas.file] });
});
}
if (!listService.lastFocusedList) {
return;
}
const explorerContext = getContext(listService.lastFocusedList);
const textFileService = accessor.get(ITextFileService);
if (explorerContext.stat) {
const stats = explorerContext.selection.length > 1 ? explorerContext.selection : [explorerContext.stat];
stats.forEach(async s => {
await textFileService.saveAs(s.resource, undefined, { availableFileSystems: [Schemas.file] });
});
}
};
CommandsRegistry.registerCommand({
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册