@@ -24,6 +24,17 @@ const CODING_SHORTEST_UNIT_MS = 5 * SECOND_IN_MS,
2424//if you have time below not coding(pressing your keyboard), the coding track record will be upload and re-track
2525 MAX_CODING_WAIT_TIME = 30 * SECOND_IN_MS ;
2626
27+ //If there a event onFileCoding with scheme in here, just ignore this event
28+ const INVALID_CODING_DOCUMENT_SCHEMES = [
29+ //there are will be a `onDidChangeTextDocument` with document scheme `git-index`
30+ //be emitted when you switch document, so ignore it
31+ 'git-index' ,
32+ //when you just look up output channel content, there will be a `onDidChangeTextDocument` be emitted
33+ 'output' ,
34+ //This is a edit event emit from you debug console input box
35+ 'input'
36+ ] ;
37+
2738var activeDocument ,
2839 uploadObjectGenerator ,
2940 //Tracking data, record document open time, first coding time and last coding time and coding time long
@@ -81,6 +92,7 @@ var EventHandler = {
8192 }
8293 } ,
8394 onActiveFileChange : ( doc ) => {
95+ log . d ( 'onActiveFileChange: ' , doc ) ;
8496 var now = Date . now ( ) ;
8597 // If there is a TextEditor opened before changed, should upload the track data
8698 if ( activeDocument ) {
@@ -99,11 +111,12 @@ var EventHandler = {
99111 trackData . codingLong = trackData . lastCodingTime = trackData . firstCodingTime = 0 ;
100112 } ,
101113 onFileCoding : ( doc ) => {
102- //ignore event emit from vscode `git-index`
103- // `vscode.workspace.onDidChangeTextDocument`
104- //because it is not a coding action
105- if ( ! doc || doc . uri . scheme == 'git-index' )
106- return ;
114+ log . d ( 'onFileCoding: ' , doc ) ;
115+
116+ //Ignore the invalid coding file schemes
117+ if ( ! doc || INVALID_CODING_DOCUMENT_SCHEMES . indexOf ( doc . uri . scheme ) >= 0 )
118+ return ;
119+
107120 var now = Date . now ( ) ;
108121 //If time is too short to calling this function then just ignore it
109122 if ( now - CODING_SHORTEST_UNIT_MS < trackData . lastCodingTime )
0 commit comments