src/vs/editor/contrib/linkedEditing/browser/linkedEditing.ts/LinkedEditingContribution/updateRanges
class LinkedEditingContribution:	public async updateRanges(force = false): Promise<void> {
		if (!this._editor.hasModel()) {
			this.clearRanges();
			return;
		}

		const position = this._editor.getPosition();
		if (!this._enabled && !force || this._editor.getSelections().length > 1) {
			// disabled or multicursor
			this.clearRanges();
			return;
		}

		const model = this._editor.getModel();
		const modelVersionId = model.getVersionId();
		if (this._currentRequestPosition && this._currentRequestModelVersion === modelVersionId) {
			if (position.equals(this._currentRequestPosition)) {
				return; // same position
			}
			if (this._currentDecorations && this._currentDecorations.length > 0) {
				const range = model.getDecorationRange(this._currentDecorations[0]);
				if (range && range.containsPosition(position)) {
					return; // just moving inside the existing primary range
				}
			}
		}

		this._currentRequestPosition = position;
		this._currentRequestModelVersion = modelVersionId;
		const request = createCancelablePromise(async token => {
			try {
				const sw = new StopWatch(false);
				const response = await getLinkedEditingRanges(this._providers, model, position, token);
				this._debounceInformation.update(model, sw.elapsed());
				if (request !== this._currentRequest) {
					return;
				}
				this._currentRequest = null;
				if (modelVersionId !== model.getVersionId()) {
					return;
				}

				let ranges: IRange[] = [];
				if (response?.ranges) {
					ranges = response.ranges;
				}

				this._currentWordPattern = response?.wordPattern || this._languageWordPattern;

				let foundReferenceRange = false;
				for (let i = 0, len = ranges.length; i < len; i++) {
					if (Range.containsPosition(ranges[i], position)) {
						foundReferenceRange = true;
						if (i !== 0) {
							const referenceRange = ranges[i];
							ranges.splice(i, 1);
							ranges.unshift(referenceRange);
						}
						break;
					}
				}

				if (!foundReferenceRange) {
					// Cannot do linked editing if the ranges are not where the cursor is...
					this.clearRanges();
					return;
				}

				const decorations: IModelDeltaDecoration[] = ranges.map(range => ({ range: range, options: LinkedEditingContribution.DECORATION }));
				this._visibleContextKey.set(true);
				this._currentDecorations = this._editor.deltaDecorations(this._currentDecorations, decorations);
			} catch (err) {
				if (!isCancellationError(err)) {
					onUnexpectedError(err);
				}
				if (this._currentRequest === request || !this._currentRequest) {
					// stop if we are still the latest request
					this.clearRanges();
				}
			}
		});
		this._currentRequest = request;
		return request;
	}