File tree Expand file tree Collapse file tree 1 file changed +20
-3
lines changed
Expand file tree Collapse file tree 1 file changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -27,10 +27,20 @@ export class ClientLogWatcher {
2727 }
2828
2929 public async collectInfoFromLog ( ) {
30- const logs = await this . getLogs ( ) ;
30+ let logs = await this . getLogs ( ) ;
3131 if ( logs ) {
32+ logs = logs . reverse ( ) ;
33+ let sessionCount = 0 ;
3234 for ( const log of logs ) {
33- if ( log . message ?. startsWith ( "Use the JDK from" ) && Date . parse ( log . timestamp ) > this . logProcessedTimestamp ) {
35+ if ( log . message ?. startsWith ( "Use the JDK from" ) ) {
36+ if ( ++ sessionCount > 1 ) {
37+ // only the lsp traces from last session should be collected.
38+ break ;
39+ }
40+
41+ if ( Date . parse ( log . timestamp ) < this . logProcessedTimestamp ) {
42+ continue ;
43+ }
3444 const info : any = { } ;
3545 info . defaultProjectJdk = log ?. message . replace ( "Use the JDK from '" , "" ) . replace ( "' as the initial default project JDK." , "" ) ;
3646
@@ -68,7 +78,7 @@ export class ClientLogWatcher {
6878 if ( match ?. length === 2 ) {
6979 sendInfo ( "" , {
7080 name : "perf-trace" ,
71- kind : key . replace ( "\\" , "" ) ,
81+ kind : escapeLspRequestName ( key ) ,
7282 time : match [ 1 ] ,
7383 } ) ;
7484 }
@@ -151,4 +161,11 @@ function parse(rawLog: string) {
151161 }
152162 }
153163 return ret ;
164+ }
165+
166+ /**
167+ * To avoid the LSP request name get redacted.
168+ */
169+ function escapeLspRequestName ( name : string ) {
170+ return name . replace ( "\\/" , "-" ) ;
154171}
You can’t perform that action at this time.
0 commit comments