mirror of
https://github.com/deepseek-ai/deepseek-harness
synced 2026-08-15 21:04:50 +00:00
Revert "fix(tui): avoid blocking reference autocomplete"
This reverts commit f565ce44db708f1186354526a170513d48b07a2c.
This commit is contained in:
@@ -33,23 +33,25 @@ export class ReferenceAutocompleteProvider implements AutocompleteProvider {
|
||||
cursorCol: number,
|
||||
options: { signal: AbortSignal; force?: boolean },
|
||||
): Promise<AutocompleteSuggestions | null> {
|
||||
const basePromise = this.base.getSuggestions(lines, cursorLine, cursorCol, options)
|
||||
const currentLine = lines[cursorLine]
|
||||
/* v8 ignore next -- Editor always supplies its current state line. */
|
||||
if (currentLine === undefined) return this.base.getSuggestions(lines, cursorLine, cursorCol, options)
|
||||
if (currentLine === undefined) return basePromise
|
||||
const token = activeAtToken(currentLine, cursorCol)
|
||||
if (token === undefined) {
|
||||
this.files.invalidate()
|
||||
return this.base.getSuggestions(lines, cursorLine, cursorCol, options)
|
||||
return basePromise
|
||||
}
|
||||
const filePromise = this.files.list(token.query, options.signal).catch(() => [])
|
||||
const sessionPromise = this.sessions === undefined || token.quoted
|
||||
? Promise.resolve([])
|
||||
: this.sessions.listCandidates(this.agent, token.query, undefined, options.signal).catch(() => [])
|
||||
// The command provider has no candidates for an active `@` token. Do not
|
||||
// await it here: upstream may defer its empty result while the editor waits
|
||||
// for this provider, which would suppress otherwise ready references.
|
||||
const [fileCandidates, sessionCandidates] = await Promise.all([filePromise, sessionPromise])
|
||||
if (options.signal.aborted) return null
|
||||
const [base, fileCandidates, sessionCandidates] = await Promise.all([
|
||||
basePromise,
|
||||
filePromise,
|
||||
sessionPromise,
|
||||
])
|
||||
if (options.signal.aborted) return base
|
||||
const fileItems: AutocompleteItem[] = fileCandidates.flatMap((candidate) => {
|
||||
const value = formatFileMention(candidate, token.quoted)
|
||||
if (value === undefined) return []
|
||||
@@ -73,8 +75,8 @@ export class ReferenceAutocompleteProvider implements AutocompleteProvider {
|
||||
}
|
||||
})
|
||||
const items = [...fileItems, ...sessionItems]
|
||||
if (items.length === 0) return null
|
||||
return { items, prefix: token.prefix }
|
||||
if (items.length === 0) return base
|
||||
return { items: [...items, ...(base?.items ?? [])], prefix: token.prefix }
|
||||
}
|
||||
|
||||
applyCompletion(
|
||||
|
||||
Reference in New Issue
Block a user