src/vs/editor/contrib/inlineCompletions/inlineCompletionsModel.ts/InlineCompletionsSession/constructor
class InlineCompletionsSession:	constructor(
		editor: IActiveCodeEditor,
		private readonly triggerPosition: Position,
		private readonly shouldUpdate: () => boolean,
		private readonly commandService: ICommandService,
	) {
		super(editor);

		let lastCompletionItem: InlineCompletion | undefined = undefined;
		this._register(this.onDidChange(() => {
			const currentCompletion = this.currentCompletion;
			if (currentCompletion && currentCompletion.sourceInlineCompletion !== lastCompletionItem) {
				lastCompletionItem = currentCompletion.sourceInlineCompletion;

				const provider = currentCompletion.sourceProvider;
				if (provider.handleItemDidShow) {
					provider.handleItemDidShow(currentCompletion.sourceInlineCompletions, lastCompletionItem);
				}
			}
		}));

		this._register(this.editor.onDidChangeCursorPosition((e) => {
			if (this.cache.value) {
				this.onDidChangeEmitter.fire();
			}
		}));

		this._register(this.editor.onDidChangeModelContent((e) => {
			if (this.cache.value) {
				let hasChanged = false;
				for (const c of this.cache.value.completions) {
					const newRange = this.textModel.getDecorationRange(c.decorationId);
					if (!newRange) {
						onUnexpectedError(new Error('Decoration has no range'));
						continue;
					}
					if (!c.synchronizedRange.equalsRange(newRange)) {
						hasChanged = true;
						c.synchronizedRange = newRange;
					}
				}
				if (hasChanged) {
					this.onDidChangeEmitter.fire();
				}
			}

			this.scheduleAutomaticUpdate();
		}));

		this._register(InlineCompletionsProviderRegistry.onDidChange(() => {
			this.updateSoon.schedule();
		}));

		this.scheduleAutomaticUpdate();
	}