@@ -9,6 +9,7 @@ import fs from '../../shared/fs/fs'
99import { getLogger } from '../../shared/logger/logger'
1010import * as diffGenerator from './diffContextGenerator'
1111import * as codewhispererClient from '../client/codewhisperer'
12+ import { predictionTrackerDefaultConfig } from '../models/constants'
1213
1314export interface FileTrackerConfig {
1415 /** Maximum number of files to track (default: 15) */
@@ -43,17 +44,8 @@ export class PredictionTracker {
4344 constructor ( extensionContext : vscode . ExtensionContext , config ?: Partial < FileTrackerConfig > ) {
4445 getLogger ( ) . debug ( 'Initializing PredictionTracker' )
4546
46- // Default configuration values
47- const defaultConfig = {
48- maxFiles : 25 ,
49- maxTotalSizeKb : 50000 ,
50- debounceIntervalMs : 2000 ,
51- maxAgeMs : 30000 , // 30 sec
52- maxSupplementalContext : 15 , // Default max supplemental contexts
53- }
54-
5547 this . config = {
56- ...defaultConfig ,
48+ ...predictionTrackerDefaultConfig ,
5749 ...config ,
5850 }
5951
@@ -62,9 +54,6 @@ export class PredictionTracker {
6254
6355 void this . ensureStorageDirectoryExists ( )
6456 void this . loadSnapshotsFromStorage ( )
65-
66- // Schedule periodic cleanup
67- // setInterval(() => this.cleanupOldSnapshots(), this.config.maxAgeMs / 2)
6857 }
6958
7059 public processEdit ( document : vscode . TextDocument , previousContent : string ) : void {
@@ -112,11 +101,8 @@ export class PredictionTracker {
112101
113102 fileSnapshots . push ( snapshot )
114103 this . snapshots . set ( filePath , fileSnapshots )
115-
116- // Update total size
117104 this . totalSize += size
118105
119- // Enforce memory limits
120106 await this . enforceMemoryLimits ( )
121107
122108 // Set a timeout to delete the snapshot after maxAgeMs
@@ -162,14 +148,12 @@ export class PredictionTracker {
162148 continue
163149 }
164150
165- // Remove the oldest snapshot
166151 const removedSnapshot = fileSnapshots . shift ( )
167152 if ( removedSnapshot ) {
168153 this . totalSize -= removedSnapshot . size
169154 await this . deleteSnapshotFromStorage ( removedSnapshot )
170155 }
171156
172- // If no snapshots left for this file, remove the file entry
173157 if ( fileSnapshots . length === 0 ) {
174158 this . snapshots . delete ( oldestFile )
175159 }
0 commit comments