Method

LspCompletionItemset_text_edit

Declaration

void
lsp_completion_item_set_text_edit (
  LspCompletionItem* self,
  LspTextEdit* value
)

Description

Sets the value of text_edit.

An edit which is applied to a document when selecting this completion. When an edit is provided the value of insertText is ignored.

Note: The range of the edit must be a single line range and it must contain the position at which completion has been requested.

Most editors support two different operations when accepting a completion item. One is to insert a completion text and the other is to replace an existing text with a completion text. Since this can usually not be predetermined by a server it can report both ranges. Clients need to signal support for InsertReplaceEdits via the textDocument.completion.completionItem.insertReplaceSupport client capability property.

Note 1: The text edit’s range as well as both ranges from an insert replace edit must be a [single line] and they must contain the position at which completion has been requested. Note 2: If an InsertReplaceEdit is returned the edit’s insert range must be a prefix of the edit’s replace range, that means it must be contained and starting at the same position.

Parameters

value

Type: LspTextEdit

The new value of text_edit.

The argument can be NULL.
The instance takes ownership of the data, and is responsible for freeing it.