(options: { force: boolean; explicitTab: boolean })
| 2227 | } |
| 2228 | |
| 2229 | private requestAutocomplete(options: { force: boolean; explicitTab: boolean }): void { |
| 2230 | if (!this.autocompleteProvider) return; |
| 2231 | |
| 2232 | if (options.force) { |
| 2233 | const shouldTrigger = |
| 2234 | !this.autocompleteProvider.shouldTriggerFileCompletion || |
| 2235 | this.autocompleteProvider.shouldTriggerFileCompletion( |
| 2236 | this.state.lines, |
| 2237 | this.state.cursorLine, |
| 2238 | this.state.cursorCol, |
| 2239 | ); |
| 2240 | if (!shouldTrigger) { |
| 2241 | return; |
| 2242 | } |
| 2243 | } |
| 2244 | |
| 2245 | this.cancelAutocompleteRequest(); |
| 2246 | const startToken = ++this.autocompleteStartToken; |
| 2247 | |
| 2248 | const debounceMs = this.getAutocompleteDebounceMs(options); |
| 2249 | if (debounceMs > 0) { |
| 2250 | this.autocompleteDebounceTimer = setTimeout(() => { |
| 2251 | this.autocompleteDebounceTimer = undefined; |
| 2252 | void this.startAutocompleteRequest(startToken, options); |
| 2253 | }, debounceMs); |
| 2254 | return; |
| 2255 | } |
| 2256 | |
| 2257 | void this.startAutocompleteRequest(startToken, options); |
| 2258 | } |
| 2259 | |
| 2260 | private async startAutocompleteRequest( |
| 2261 | startToken: number, |
no test coverage detected