File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import { URI } from 'vs/base/common/uri';
1313import { TextChange , compressConsecutiveTextChanges } from 'vs/editor/common/model/textChange' ;
1414import * as buffer from 'vs/base/common/buffer' ;
1515import { IDisposable } from 'vs/base/common/lifecycle' ;
16+ import { basename } from 'vs/base/common/resources' ;
1617
1718function uriGetComparisonKey ( resource : URI ) : string {
1819 return resource . toString ( ) ;
@@ -340,6 +341,14 @@ export class MultiModelEditStackElement implements IWorkspaceUndoRedoElement {
340341 public split ( ) : IResourceUndoRedoElement [ ] {
341342 return this . _editStackElementsArr ;
342343 }
344+
345+ public toString ( ) : string {
346+ let result : string [ ] = [ ] ;
347+ for ( const editStackElement of this . _editStackElementsArr ) {
348+ result . push ( `${ basename ( editStackElement . resource ) } : ${ editStackElement } ` ) ;
349+ }
350+ return `{${ result . join ( ', ' ) } }` ;
351+ }
343352}
344353
345354export type EditStackElement = SingleModelEditStackElement | MultiModelEditStackElement ;
Original file line number Diff line number Diff line change 66import * as buffer from 'vs/base/common/buffer' ;
77import { decodeUTF16LE } from 'vs/editor/common/core/stringBuilder' ;
88
9+ function escapeNewLine ( str : string ) : string {
10+ return (
11+ str
12+ . replace ( / \n / g, '\\n' )
13+ . replace ( / \r / g, '\\r' )
14+ ) ;
15+ }
16+
917export class TextChange {
1018
1119 public get oldLength ( ) : number {
@@ -33,12 +41,12 @@ export class TextChange {
3341
3442 public toString ( ) : string {
3543 if ( this . oldText . length === 0 ) {
36- return `(insert@${ this . oldPosition } "${ this . newText } ")` ;
44+ return `(insert@${ this . oldPosition } "${ escapeNewLine ( this . newText ) } ")` ;
3745 }
3846 if ( this . newText . length === 0 ) {
39- return `(delete@${ this . oldPosition } "${ this . oldText } ")` ;
47+ return `(delete@${ this . oldPosition } "${ escapeNewLine ( this . oldText ) } ")` ;
4048 }
41- return `(replace@${ this . oldPosition } "${ this . oldText } " with "${ this . newText } ")` ;
49+ return `(replace@${ this . oldPosition } "${ escapeNewLine ( this . oldText ) } " with "${ escapeNewLine ( this . newText ) } ")` ;
4250 }
4351
4452 private static _writeStringSize ( str : string ) : number {
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ class ResourceStackElement {
5151 }
5252
5353 public toString ( ) : string {
54- return `[${ this . id } ] [${ this . isValid ? 'VALID' : 'INVALID' } ] ${ this . actual } ` ;
54+ return `[id: ${ this . id } ] [group: ${ this . groupId } ] [${ this . isValid ? 'VALID' : 'INVALID' } ] ${ this . actual } ` ;
5555 }
5656}
5757
@@ -172,7 +172,7 @@ class WorkspaceStackElement {
172172 }
173173
174174 public toString ( ) : string {
175- return `[${ this . id } ] [${ this . invalidatedResources ? 'INVALID' : 'VALID' } ] ${ this . actual } ` ;
175+ return `[id: ${ this . id } ] [group: ${ this . groupId } ] [${ this . invalidatedResources ? 'INVALID' : 'VALID' } ] ${ this . actual } ` ;
176176 }
177177}
178178
You can’t perform that action at this time.
0 commit comments