Skip to content

Commit

Permalink
feat: no block when whole completion panel when incomplete is true
Browse files Browse the repository at this point in the history
  • Loading branch information
hexh250786313 committed Jun 2, 2024
1 parent ba3c0a9 commit 91d3c24
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 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
2 changes: 1 addition & 1 deletion src/completion/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export class Completion implements Disposable {
if (!this.option) return
this.popupEvent = ev
let resolved = this.complete.resolveItem(this.selectedItem)
if (!resolved || (!ev.move && this.complete.isCompleting)) return
if (!resolved) return
let detailRendered = this.selectedItem.detailRendered
let showDocs = this.config.enableFloat
await this.floating.resolveItem(resolved.source, resolved.item, this.option, showDocs, detailRendered)
Expand Down

0 comments on commit 91d3c24

Please sign in to comment.