22// Licensed under the MIT License.
33'use strict' ;
44import { inject , injectable } from 'inversify' ;
5+ import * as uuid from 'uuid/v4' ;
56import { CodeLens , Command , Position , Range , Selection , TextDocument , TextEditor , TextEditorRevealType } from 'vscode' ;
67
78import { IApplicationShell , IDocumentManager } from '../../common/application/types' ;
@@ -87,7 +88,7 @@ export class CodeWatcher implements ICodeWatcher {
8788 const range : Range = new Range ( lens . command . arguments [ 1 ] , lens . command . arguments [ 2 ] , lens . command . arguments [ 3 ] , lens . command . arguments [ 4 ] ) ;
8889 if ( this . document && range ) {
8990 const code = this . document . getText ( range ) ;
90- await activeHistory . addCode ( code , this . getFileName ( ) , range . start . line , id ) ;
91+ await activeHistory . addCode ( code , this . getFileName ( ) , range . start . line , uuid ( ) ) ;
9192 }
9293 }
9394 }
@@ -96,7 +97,7 @@ export class CodeWatcher implements ICodeWatcher {
9697 if ( this . codeLenses . length === 0 ) {
9798 if ( this . document ) {
9899 const code = this . document . getText ( ) ;
99- await activeHistory . addCode ( code , this . getFileName ( ) , 0 , id ) ;
100+ await activeHistory . addCode ( code , this . getFileName ( ) , 0 , uuid ( ) ) ;
100101 }
101102 }
102103 }
@@ -119,7 +120,7 @@ export class CodeWatcher implements ICodeWatcher {
119120 }
120121
121122 if ( code && code . trim ( ) . length ) {
122- await activeHistory . addCode ( code , this . getFileName ( ) , activeEditor . selection . start . line , id , activeEditor ) ;
123+ await activeHistory . addCode ( code , this . getFileName ( ) , activeEditor . selection . start . line , uuid ( ) , activeEditor ) ;
123124 }
124125 }
125126 }
@@ -132,7 +133,7 @@ export class CodeWatcher implements ICodeWatcher {
132133 const code = this . document . getText ( range ) ;
133134
134135 try {
135- await activeHistory . addCode ( code , this . getFileName ( ) , range . start . line , id , this . documentManager . activeTextEditor ) ;
136+ await activeHistory . addCode ( code , this . getFileName ( ) , range . start . line , uuid ( ) , this . documentManager . activeTextEditor ) ;
136137 } catch ( err ) {
137138 this . handleError ( err ) ;
138139 }
0 commit comments