mirror of
https://github.com/Microsoft/vscode
synced 2024-10-12 22:37:41 +00:00
Improve debugging output
This commit is contained in:
parent
4aa873b4d1
commit
83f8f52cbf
|
@ -13,6 +13,7 @@ import { URI } from 'vs/base/common/uri';
|
|||
import { TextChange, compressConsecutiveTextChanges } from 'vs/editor/common/model/textChange';
|
||||
import * as buffer from 'vs/base/common/buffer';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { basename } from 'vs/base/common/resources';
|
||||
|
||||
function uriGetComparisonKey(resource: URI): string {
|
||||
return resource.toString();
|
||||
|
@ -340,6 +341,14 @@ export class MultiModelEditStackElement implements IWorkspaceUndoRedoElement {
|
|||
public split(): IResourceUndoRedoElement[] {
|
||||
return this._editStackElementsArr;
|
||||
}
|
||||
|
||||
public toString(): string {
|
||||
let result: string[] = [];
|
||||
for (const editStackElement of this._editStackElementsArr) {
|
||||
result.push(`${basename(editStackElement.resource)}: ${editStackElement}`);
|
||||
}
|
||||
return `{${result.join(', ')}}`;
|
||||
}
|
||||
}
|
||||
|
||||
export type EditStackElement = SingleModelEditStackElement | MultiModelEditStackElement;
|
||||
|
|
|
@ -6,6 +6,14 @@
|
|||
import * as buffer from 'vs/base/common/buffer';
|
||||
import { decodeUTF16LE } from 'vs/editor/common/core/stringBuilder';
|
||||
|
||||
function escapeNewLine(str: string): string {
|
||||
return (
|
||||
str
|
||||
.replace(/\n/g, '\\n')
|
||||
.replace(/\r/g, '\\r')
|
||||
);
|
||||
}
|
||||
|
||||
export class TextChange {
|
||||
|
||||
public get oldLength(): number {
|
||||
|
@ -33,12 +41,12 @@ export class TextChange {
|
|||
|
||||
public toString(): string {
|
||||
if (this.oldText.length === 0) {
|
||||
return `(insert@${this.oldPosition} "${this.newText}")`;
|
||||
return `(insert@${this.oldPosition} "${escapeNewLine(this.newText)}")`;
|
||||
}
|
||||
if (this.newText.length === 0) {
|
||||
return `(delete@${this.oldPosition} "${this.oldText}")`;
|
||||
return `(delete@${this.oldPosition} "${escapeNewLine(this.oldText)}")`;
|
||||
}
|
||||
return `(replace@${this.oldPosition} "${this.oldText}" with "${this.newText}")`;
|
||||
return `(replace@${this.oldPosition} "${escapeNewLine(this.oldText)}" with "${escapeNewLine(this.newText)}")`;
|
||||
}
|
||||
|
||||
private static _writeStringSize(str: string): number {
|
||||
|
|
|
@ -51,7 +51,7 @@ class ResourceStackElement {
|
|||
}
|
||||
|
||||
public toString(): string {
|
||||
return `[${this.id}] [${this.isValid ? 'VALID' : 'INVALID'}] ${this.actual}`;
|
||||
return `[id:${this.id}] [group:${this.groupId}] [${this.isValid ? 'VALID' : 'INVALID'}] ${this.actual}`;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -172,7 +172,7 @@ class WorkspaceStackElement {
|
|||
}
|
||||
|
||||
public toString(): string {
|
||||
return `[${this.id}] [${this.invalidatedResources ? 'INVALID' : 'VALID'}] ${this.actual}`;
|
||||
return `[id:${this.id}] [group:${this.groupId}] [${this.invalidatedResources ? 'INVALID' : 'VALID'}] ${this.actual}`;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue