Skip to content

Commit

Permalink
feat: no blocking when inCompletion
Browse files Browse the repository at this point in the history
  • Loading branch information
hexh250786313 committed Jun 2, 2024
1 parent fe62abd commit 7f325f1
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/completion/complete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,11 +241,10 @@ export default class Complete {
return added
}

public async completeInComplete(resumeInput: string): Promise<DurationCompleteItem[] | undefined> {
public async completeInComplete(resumeInput: string) {
let { document } = this
this.cancelInComplete()
let tokenSource = this.createTokenSource(true)
let token = tokenSource.token
await document.patchChange(true)
let { input, colnr, linenr, followWord, position } = this.option
Object.assign(this.option, {
Expand All @@ -257,11 +256,8 @@ export default class Complete {
triggerCharacter: undefined,
triggerForInComplete: true
})
this.cid++
const sources = this.getIncompleteSources()
await this.completeSources(sources, tokenSource, this.cid)
if (token.isCancellationRequested) return undefined
return this.filterItems(resumeInput)
}

public filterItems(input: string): DurationCompleteItem[] | undefined {
Expand Down Expand Up @@ -322,7 +318,7 @@ export default class Complete {
public async filterResults(input: string): Promise<DurationCompleteItem[] | undefined> {
clearTimeout(this.timer)
if (input !== this.option.input && this.hasInComplete) {
return await this.completeInComplete(input)
void this.completeInComplete(input)
}
return this.filterItems(input)
}
Expand Down

0 comments on commit 7f325f1

Please sign in to comment.