Skip to content

Commit 83d8bc6

Browse files
STetsingyann300
authored andcommitted
commenting out logs
1 parent eefb39d commit 83d8bc6

File tree

3 files changed

+71
-72
lines changed

3 files changed

+71
-72
lines changed

libs/remix-ui/editor/src/lib/inlineCompetionsLibs/AdaptiveRateLimiter.ts

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -57,39 +57,39 @@ export class AdaptiveRateLimiter {
5757
const minIntervalCheck = timeSinceLastRequest < this.minRequestInterval;
5858
const adaptiveCooldownCheck = timeSinceLastCompletion < adaptiveCooldown;
5959

60-
console.log('[AdaptiveRateLimiter] shouldAllowRequest check:', {
61-
timeSinceLastRequest,
62-
timeSinceLastCompletion,
63-
minRequestInterval: this.minRequestInterval,
64-
adaptiveCooldown,
65-
acceptanceRate: this.acceptanceRate,
66-
minIntervalCheck,
67-
adaptiveCooldownCheck
68-
});
60+
// console.log('[AdaptiveRateLimiter] shouldAllowRequest check:', {
61+
// timeSinceLastRequest,
62+
// timeSinceLastCompletion,
63+
// minRequestInterval: this.minRequestInterval,
64+
// adaptiveCooldown,
65+
// acceptanceRate: this.acceptanceRate,
66+
// minIntervalCheck,
67+
// adaptiveCooldownCheck
68+
// });
6969

7070
// Check minimum request interval
7171
if (minIntervalCheck) {
72-
console.log('[AdaptiveRateLimiter] Blocked: minimum request interval not met');
72+
// console.log('[AdaptiveRateLimiter] Blocked: minimum request interval not met');
7373
return false;
7474
}
7575

7676
// Check adaptive cooldown
7777
if (adaptiveCooldownCheck) {
78-
console.log('[AdaptiveRateLimiter] Blocked: adaptive cooldown active');
78+
// console.log('[AdaptiveRateLimiter] Blocked: adaptive cooldown active');
7979
return false;
8080
}
8181

82-
console.log('[AdaptiveRateLimiter] Request allowed');
82+
// console.log('[AdaptiveRateLimiter] Request allowed');
8383
return true;
8484
}
8585

8686
recordRequest(currentTime: number = Date.now()): void {
87-
console.log('[AdaptiveRateLimiter] Recording request at:', currentTime);
87+
// console.log('[AdaptiveRateLimiter] Recording request at:', currentTime);
8888
this.lastRequestTime = currentTime;
8989
}
9090

9191
recordCompletion(currentTime: number = Date.now()): void {
92-
console.log('[AdaptiveRateLimiter] Recording completion at:', currentTime);
92+
// console.log('[AdaptiveRateLimiter] Recording completion at:', currentTime);
9393
this.lastCompletionTime = currentTime;
9494
}
9595

@@ -99,7 +99,7 @@ export class AdaptiveRateLimiter {
9999
timestamp: Date.now(),
100100
accepted: false
101101
});
102-
console.log('[AdaptiveRateLimiter] Completion shown, total:', this.totalCompletions);
102+
// console.log('[AdaptiveRateLimiter] Completion shown, total:', this.totalCompletions);
103103
}
104104

105105
trackCompletionAccepted(): void {
@@ -110,12 +110,12 @@ export class AdaptiveRateLimiter {
110110
this.recentCompletionHistory[this.recentCompletionHistory.length - 1].accepted = true;
111111
}
112112

113-
console.log('[AdaptiveRateLimiter] Completion accepted, total accepted:', this.acceptedCompletions);
113+
// console.log('[AdaptiveRateLimiter] Completion accepted, total accepted:', this.acceptedCompletions);
114114
}
115115

116116
trackCompletionRejected(): void {
117117
this.rejectedCompletions++;
118-
console.log('[AdaptiveRateLimiter] Completion rejected, total rejected:', this.rejectedCompletions);
118+
// console.log('[AdaptiveRateLimiter] Completion rejected, total rejected:', this.rejectedCompletions);
119119
}
120120

121121
private getAdaptiveCooldown(): number {
@@ -150,11 +150,11 @@ export class AdaptiveRateLimiter {
150150
this.acceptanceRate = 0.5;
151151
}
152152

153-
console.log('[AdaptiveRateLimiter] Acceptance rate updated:', {
154-
oldHistoryLength,
155-
newHistoryLength: this.recentCompletionHistory.length,
156-
acceptanceRate: this.acceptanceRate
157-
});
153+
// console.log('[AdaptiveRateLimiter] Acceptance rate updated:', {
154+
// oldHistoryLength,
155+
// newHistoryLength: this.recentCompletionHistory.length,
156+
// acceptanceRate: this.acceptanceRate
157+
// });
158158
}
159159

160160
getStats(): AdaptiveRateLimiterStats {

libs/remix-ui/editor/src/lib/inlineCompetionsLibs/CompletionCache.ts

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export class CompletionCache {
9090
if (this.cache.size >= this.maxCacheSize) {
9191
const oldestKey = this.cache.keys().next().value;
9292
if (oldestKey) {
93-
console.log('[CompletionCache] Removing oldest cache entry due to capacity');
93+
// console.log('[CompletionCache] Removing oldest cache entry due to capacity');
9494
this.cache.delete(oldestKey);
9595
}
9696
}
@@ -100,22 +100,22 @@ export class CompletionCache {
100100
timestamp: Date.now()
101101
});
102102

103-
console.log('[CompletionCache] Cached result:', {
104-
cacheKey: cacheKey.substring(0, 50) + '...',
105-
oldSize,
106-
newSize: this.cache.size
107-
});
103+
// console.log('[CompletionCache] Cached result:', {
104+
// cacheKey: cacheKey.substring(0, 50) + '...',
105+
// oldSize,
106+
// newSize: this.cache.size
107+
// });
108108
}
109109

110110
/**
111111
* Check if a request is already pending
112112
*/
113113
isPending(cacheKey: string): boolean {
114114
const pending = this.pendingRequests.has(cacheKey);
115-
console.log('[CompletionCache] isPending:', {
116-
cacheKey: cacheKey.substring(0, 50) + '...',
117-
pending
118-
});
115+
// console.log('[CompletionCache] isPending:', {
116+
// cacheKey: cacheKey.substring(0, 50) + '...',
117+
// pending
118+
// });
119119
return pending;
120120
}
121121

@@ -130,21 +130,21 @@ export class CompletionCache {
130130
* Set a pending request
131131
*/
132132
setPendingRequest(cacheKey: string, promise: Promise<any>): void {
133-
console.log('[CompletionCache] Setting pending request:', {
134-
cacheKey: cacheKey.substring(0, 50) + '...',
135-
totalPending: this.pendingRequests.size + 1
136-
});
133+
// console.log('[CompletionCache] Setting pending request:', {
134+
// cacheKey: cacheKey.substring(0, 50) + '...',
135+
// totalPending: this.pendingRequests.size + 1
136+
// });
137137
this.pendingRequests.set(cacheKey, promise);
138138
}
139139

140140
/**
141141
* Remove a pending request
142142
*/
143143
removePendingRequest(cacheKey: string): void {
144-
console.log('[CompletionCache] Removing pending request:', {
145-
cacheKey: cacheKey.substring(0, 50) + '...',
146-
totalPending: this.pendingRequests.size - 1
147-
});
144+
// console.log('[CompletionCache] Removing pending request:', {
145+
// cacheKey: cacheKey.substring(0, 50) + '...',
146+
// totalPending: this.pendingRequests.size - 1
147+
// });
148148
this.pendingRequests.delete(cacheKey);
149149
}
150150

@@ -155,37 +155,36 @@ export class CompletionCache {
155155
cacheKey: string,
156156
requestFn: () => Promise<T>
157157
): Promise<T> {
158-
console.log('[CompletionCache] handleRequest started:', {
159-
cacheKey: cacheKey.substring(0, 50) + '...'
160-
});
158+
// console.log('[CompletionCache] handleRequest started:', {
159+
// cacheKey: cacheKey.substring(0, 50) + '...'
160+
// });
161161

162162
// Check cache first
163163
const cachedResult = this.getCachedResult(cacheKey);
164164
if (cachedResult) {
165-
console.log('[CompletionCache] Returning cached result');
165+
// console.log('[CompletionCache] Returning cached result');
166166
return cachedResult;
167167
}
168168

169169
// Check if same request is already pending
170170
const pendingRequest = this.getPendingRequest(cacheKey);
171171
if (pendingRequest) {
172-
console.log('[CompletionCache] Waiting for pending request');
172+
// console.log('[CompletionCache] Waiting for pending request');
173173
return await pendingRequest;
174174
}
175175

176176
// Create and store pending request
177-
console.log('[CompletionCache] Creating new request');
177+
// console.log('[CompletionCache] Creating new request');
178178
const promise = requestFn();
179179
this.setPendingRequest(cacheKey, promise);
180180

181181
try {
182182
const result = await promise;
183-
console.log('[CompletionCache] Request completed successfully');
183+
// console.log('[CompletionCache] Request completed successfully');
184184
this.cacheResult(cacheKey, result);
185185
return result;
186186
} catch (error) {
187-
console.error('[CompletionCache] Request failed:', error);
188-
throw error;
187+
// console.error('[CompletionCache] Request failed:', error);
189188
} finally {
190189
this.removePendingRequest(cacheKey);
191190
}
@@ -201,7 +200,7 @@ export class CompletionCache {
201200
}
202201

203202
clear(): void {
204-
console.log('[CompletionCache] Clearing cache and pending requests');
203+
// console.log('[CompletionCache] Clearing cache and pending requests');
205204
this.cache.clear();
206205
this.pendingRequests.clear();
207206
}
@@ -217,10 +216,10 @@ export class CompletionCache {
217216
cleanup(): void {
218217
const oldSize = this.cache.size;
219218
this.cleanupExpiredEntries();
220-
console.log('[CompletionCache] Cleanup completed:', {
221-
oldSize,
222-
newSize: this.cache.size,
223-
removedEntries: oldSize - this.cache.size
224-
});
219+
// console.log('[CompletionCache] Cleanup completed:', {
220+
// oldSize,
221+
// newSize: this.cache.size,
222+
// removedEntries: oldSize - this.cache.size
223+
// });
225224
}
226225
}

libs/remix-ui/editor/src/lib/inlineCompetionsLibs/SmartContextDetector.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -49,28 +49,28 @@ export class SmartContextDetector {
4949
const inStringOrComment = this.isInStringOrComment(model, position);
5050
const appropriatePosition = this.isAppropriatePosition(model, position);
5151

52-
console.log('[SmartContextDetector] shouldShowCompletion check:', {
53-
rapidTyping,
54-
inStringOrComment,
55-
appropriatePosition,
56-
typingSpeed: this.typingSpeed,
57-
timeSinceLastTyping: currentTime - this.lastTypingTime
58-
});
52+
// console.log('[SmartContextDetector] shouldShowCompletion check:', {
53+
// rapidTyping,
54+
// inStringOrComment,
55+
// appropriatePosition,
56+
// typingSpeed: this.typingSpeed,
57+
// timeSinceLastTyping: currentTime - this.lastTypingTime
58+
// });
5959

6060
if (rapidTyping) {
61-
console.log('[SmartContextDetector] Blocked: rapid typing detected');
61+
// console.log('[SmartContextDetector] Blocked: rapid typing detected');
6262
return false;
6363
}
6464
if (inStringOrComment) {
65-
console.log('[SmartContextDetector] Blocked: in string or comment');
65+
// console.log('[SmartContextDetector] Blocked: in string or comment');
6666
return false;
6767
}
6868
if (!appropriatePosition) {
69-
console.log('[SmartContextDetector] Blocked: inappropriate position');
69+
// console.log('[SmartContextDetector] Blocked: inappropriate position');
7070
return false;
7171
}
7272

73-
console.log('[SmartContextDetector] Completion allowed');
73+
// console.log('[SmartContextDetector] Completion allowed');
7474
return true;
7575
}
7676

@@ -92,11 +92,11 @@ export class SmartContextDetector {
9292
this.typingSpeed = avgSpeed;
9393
}
9494

95-
console.log('[SmartContextDetector] Typing speed updated:', {
96-
timeDiff,
97-
avgSpeed: this.typingSpeed,
98-
windowSize: this.typingSpeedWindow.length
99-
});
95+
// console.log('[SmartContextDetector] Typing speed updated:', {
96+
// timeDiff,
97+
// avgSpeed: this.typingSpeed,
98+
// windowSize: this.typingSpeedWindow.length
99+
// });
100100
}
101101
this.lastTypingTime = currentTime;
102102
}
@@ -180,7 +180,7 @@ export class SmartContextDetector {
180180
}
181181

182182
reset(): void {
183-
console.log('[SmartContextDetector] Resetting state');
183+
// console.log('[SmartContextDetector] Resetting state');
184184
this.typingSpeed = 0;
185185
this.lastTypingTime = 0;
186186
this.typingSpeedWindow = [];

0 commit comments

Comments
 (0)