@@ -51,8 +51,14 @@ export interface ContextProvider<T extends SupportedContextItem> {
5151 selector : DocumentSelector ;
5252 resolver : ContextResolver < T > ;
5353}
54+
55+ export type ResolveOnTimeoutResult < T > = T | readonly T [ ] ;
56+ export type ResolveResult < T > = Promise < T > | Promise < readonly T [ ] > | AsyncIterable < T > ;
57+
5458export interface ContextResolver < T extends SupportedContextItem > {
55- resolve ( request : ResolveRequest , token : CancellationToken ) : Promise < T > | Promise < T [ ] > | AsyncIterable < T > ;
59+ resolve ( request : ResolveRequest , token : CancellationToken ) : ResolveResult < T > ;
60+ // Optional method to be invoked if the request timed out. This requests additional context items.
61+ resolveOnTimeout ?( request : ResolveRequest ) : ResolveOnTimeoutResult < T > | undefined ;
5662}
5763
5864/**
@@ -141,14 +147,6 @@ export interface ResolveRequest {
141147 data ?: unknown ;
142148}
143149
144- /**
145- * A context item marked as backup will only be used if the provider hits the timeout
146- * and is not able to fully resolve.
147- */
148- export enum ContextItemTag {
149- Backup = 'backup' ,
150- }
151-
152150/**
153151 * These are the data types that can be provided by a context provider. Any non-conforming
154152 * context items will be filtered out.
@@ -175,13 +173,6 @@ interface ContextItem {
175173 * - update: context is provided via context/update
176174 */
177175 origin ?: ContextItemOrigin ;
178-
179- /**
180- * Tags are used to provide additional metadata about the context item. Valid tags
181- * are defined in the ContextItemTag. The type is a string[] to allow arbitrary tags
182- * to be passed without failing schema validation.
183- */
184- tags ?: string [ ] ;
185176}
186177
187178// A key-value pair used for short string snippets.
0 commit comments