@@ -173,10 +173,15 @@ namespace ts.server {
173173 export function createSortedArray < T > ( ) : SortedArray < T > {
174174 return [ ] as SortedArray < T > ;
175175 }
176+ }
176177
178+ /* @internal */
179+ namespace ts . server {
177180 export class ThrottledOperations {
178- private pendingTimeouts : Map < any > = createMap < any > ( ) ;
179- constructor ( private readonly host : ServerHost ) {
181+ private readonly pendingTimeouts : Map < any > = createMap < any > ( ) ;
182+ private readonly logger ?: Logger | undefined ;
183+ constructor ( private readonly host : ServerHost , logger : Logger ) {
184+ this . logger = logger . hasLevel ( LogLevel . verbose ) && logger ;
180185 }
181186
182187 public schedule ( operationId : string , delay : number , cb : ( ) => void ) {
@@ -187,10 +192,16 @@ namespace ts.server {
187192 }
188193 // schedule new operation, pass arguments
189194 this . pendingTimeouts . set ( operationId , this . host . setTimeout ( ThrottledOperations . run , delay , this , operationId , cb ) ) ;
195+ if ( this . logger ) {
196+ this . logger . info ( `Scheduled: ${ operationId } ${ pendingTimeout ? ", Cancelled earlier one" : "" } ` ) ;
197+ }
190198 }
191199
192200 private static run ( self : ThrottledOperations , operationId : string , cb : ( ) => void ) {
193201 self . pendingTimeouts . delete ( operationId ) ;
202+ if ( self . logger ) {
203+ self . logger . info ( `Running: ${ operationId } ` ) ;
204+ }
194205 cb ( ) ;
195206 }
196207 }
@@ -221,10 +232,7 @@ namespace ts.server {
221232 }
222233 }
223234 }
224- }
225235
226- /* @internal */
227- namespace ts . server {
228236 export function getBaseConfigFileName ( configFilePath : NormalizedPath ) : "tsconfig.json" | "jsconfig.json" | undefined {
229237 const base = getBaseFileName ( configFilePath ) ;
230238 return base === "tsconfig.json" || base === "jsconfig.json" ? base : undefined ;
0 commit comments