Documentation for usage of CompletionItem's range property

Author: manunamzCreated May 31, 2022Updated Dec 9, 2025
Labelsfeature-request

vscode's CompletionItem[^1] supports a range property which is (from the docs):

A range or a insert and replace range selecting the text that should be replaced by this completion item.

When omitted, the range of the current word is used as replace-range and as insert-range the start of the current word to the current position is used.

Note 1: A range must be a single line and it must contain the position at which completion has been requested. Note 2: A insert range must be a prefix of a replace range, that means it must be contained and starting at the same position.

Further documentation/an example illustrating how to use the range property would be incredibly useful.

Even better would be an example of how the trigger character(s) may be overwritten with either the insertText property or by some other method.

[^1]: Also wondering if this issue is related.

Source: microsoft/vscode-extension-samples