@@ -3,7 +3,7 @@ import { logger } from "./logger";
33import { ModelProviderManager } from "./providers" ;
44import { statusIcon } from "./status-icon" ;
55import { storage } from "./storage" ;
6- import { getLanguageConfig } from "./utilities" ;
6+ import { getLanguageConfig , Queue } from "./utilities" ;
77
88/**
99 * InlineCompletionProvider class provides inline completion functionality for the active document.
@@ -108,14 +108,25 @@ class InlineCompletionProvider implements vscode.InlineCompletionItemProvider {
108108 } ) ;
109109 }
110110
111+ private readonly queue = new Queue < vscode . InlineCompletionList > ( 500 ) ;
112+ private async generateCompletions (
113+ document : vscode . TextDocument ,
114+ position : vscode . Position ,
115+ abortController : AbortController ,
116+ ) : Promise < vscode . InlineCompletionList > {
117+ return this . queue . enqueue ( ( ) =>
118+ this . doGenerateCompletions ( document , position , abortController ) ,
119+ ) ;
120+ }
121+
111122 /**
112123 * Generates completions for the current document.
113124 * @param {vscode.TextDocument } document - The current document.
114125 * @param {vscode.Position } position - The current position in the document.
115126 * @param {AbortController } abortController - The abort controller for the operation.
116127 * @returns {Promise<vscode.InlineCompletionList> } A list of inline completions.
117128 */
118- private async generateCompletions (
129+ private async doGenerateCompletions (
119130 document : vscode . TextDocument ,
120131 position : vscode . Position ,
121132 abortController : AbortController ,
0 commit comments