(ctx: any)
| 61 | |
| 62 | // Process items from unprocessed queue |
| 63 | async process(ctx: any): Promise<void> { |
| 64 | while ( |
| 65 | this.unprocessedQueue.length > 0 && |
| 66 | this.processedQueue.length < this.prefetchLimit && |
| 67 | !this.abortController.signal.aborted |
| 68 | ) { |
| 69 | const location = this.dequeueUnprocessed(); |
| 70 | console.log("processing:"); |
| 71 | console.log( |
| 72 | location?.range.start.line + " to " + location?.range.end.line, |
| 73 | ); |
| 74 | |
| 75 | if (!location) break; |
| 76 | |
| 77 | try { |
| 78 | const outcome = |
| 79 | await NextEditProvider.getInstance().provideInlineCompletionItemsWithChain( |
| 80 | ctx, |
| 81 | location, |
| 82 | this.abortController.signal, |
| 83 | this.usingFullFileDiff, |
| 84 | ); |
| 85 | |
| 86 | if (!outcome) { |
| 87 | console.log("outcome is undefined"); |
| 88 | continue; |
| 89 | } |
| 90 | |
| 91 | this.enqueueProcessed({ |
| 92 | location, |
| 93 | outcome, |
| 94 | }); |
| 95 | |
| 96 | console.log( |
| 97 | "the length of processed queue after processing is:", |
| 98 | this.processedQueue.length, |
| 99 | ); |
| 100 | } catch (error) { |
| 101 | if (!this.abortController.signal.aborted) { |
| 102 | // Handle error |
| 103 | console.error("Error processing item:", error); |
| 104 | } |
| 105 | // If aborted, we just stop processing |
| 106 | break; |
| 107 | } |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | // Abort all operations |
| 112 | abort(): void { |
no test coverage detected