Method

LspCompletionItemget_text_edit

Declaration

LspTextEdit*
lsp_completion_item_get_text_edit (
  LspCompletionItem* self
)

Description

Gets 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.

Return value

Type: LspTextEdit

The value of text_edit.

The returned data is owned by the instance.
The return value can be NULL.