src/vs/workbench/api/common/extHostLanguageFeatures.ts/InlineCompletionAdapter/provideInlineCompletions
class InlineCompletionAdapter:	public async provideInlineCompletions(resource: URI, position: IPosition, context: vscode.InlineCompletionContext, token: CancellationToken): Promise<extHostProtocol.IdentifiableInlineCompletions | undefined> {
		const doc = this._documents.getDocument(resource);
		const pos = typeConvert.Position.to(position);

		const result = await asPromise(() => this._provider.provideInlineCompletionItems(doc, pos, context, token));

		if (!result) {
			// undefined and null are valid results
			return undefined;
		}

		if (token.isCancellationRequested) {
			// cancelled -> return without further ado, esp no caching
			// of results as they will leak
			return undefined;
		}

		const normalizedResult: vscode.InlineCompletionList = isArray(result) ? { items: result } : result;

		const pid = this._cache.add(normalizedResult.items);
		let disposableStore: DisposableStore | undefined = undefined;

		return {
			pid,
			items: normalizedResult.items.map<extHostProtocol.IdentifiableInlineCompletion>((item, idx) => {
				let command: modes.Command | undefined = undefined;
				if (item.command) {
					if (!disposableStore) {
						disposableStore = new DisposableStore();
						this._disposables.set(pid, disposableStore);
					}
					command = this._commands.toInternal(item.command, disposableStore);
				}

				return ({
					text: item.text,
					range: item.range ? typeConvert.Range.from(item.range) : undefined,
					command,
					idx: idx,
				});
			}),
		};
	}