src/vs/editor/contrib/inlineCompletions/browser/inlineCompletionsModel.ts/InlineCompletionsSession/constructor
class InlineCompletionsSession:	constructor(
		editor: IActiveCodeEditor,
		private readonly triggerPosition: Position,
		private readonly shouldUpdate: () => boolean,
		private readonly commandService: ICommandService,
		private readonly cache: SharedInlineCompletionCache,
		private initialTriggerKind: InlineCompletionTriggerKind,
		private readonly languageConfigurationService: ILanguageConfigurationService,
		private readonly registry: LanguageFeatureRegistry<InlineCompletionsProvider>,
		private readonly debounce: IFeatureDebounceInformation,
	) {
		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;
				provider.handleItemDidShow?.(currentCompletion.sourceInlineCompletions, lastCompletionItem);
			}
		}));

		this._register(toDisposable(() => {
			this.cache.clear();
		}));

		this._register(this.editor.onDidChangeCursorPosition((e) => {
			if (e.reason === CursorChangeReason.Explicit) {
				return;
			}
			// Ghost text depends on the cursor position
			this.cache.value?.updateRanges();
			if (this.cache.value) {
				this.updateFilteredInlineCompletions();
				this.onDidChangeEmitter.fire();
			}
		}));

		this._register(this.editor.onDidChangeModelContent((e) => {
			// Call this in case `onDidChangeModelContent` calls us first.
			this.cache.value?.updateRanges();
			this.updateFilteredInlineCompletions();
			this.scheduleAutomaticUpdate();
		}));

		this._register(this.registry.onDidChange(() => {
			this.updateSoon.schedule(this.debounce.get(this.editor.getModel()));
		}));

		this.scheduleAutomaticUpdate();
	}