// EditsFromDiffEdits converts diff.Edits to a non-nil slice of LSP TextEdits. // See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textEditArray func EditsFromDiffEdits(m *Mapper, edits []diff.Edit) ([]TextEdit, error) { … } // EditsToDiffEdits converts LSP TextEdits to diff.Edits. // See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textEditArray func EditsToDiffEdits(m *Mapper, edits []TextEdit) ([]diff.Edit, error) { … } // ApplyEdits applies the patch (edits) to m.Content and returns the result. // It also returns the edits converted to diff-package form. func ApplyEdits(m *Mapper, edits []TextEdit) ([]byte, []diff.Edit, error) { … } // AsTextEdits converts a slice possibly containing AnnotatedTextEdits // to a slice of TextEdits. func AsTextEdits(edits []Or_TextDocumentEdit_edits_Elem) []TextEdit { … } // AsAnnotatedTextEdits converts a slice of TextEdits // to a slice of Or_TextDocumentEdit_edits_Elem. // (returning a typed nil is required in server: in code_action.go and command.go)) func AsAnnotatedTextEdits(edits []TextEdit) []Or_TextDocumentEdit_edits_Elem { … } type fileHandle … // NewWorkspaceEdit constructs a WorkspaceEdit from a list of document changes. // // Any ChangeAnnotations must be added after. func NewWorkspaceEdit(changes ...DocumentChange) *WorkspaceEdit { … } // DocumentChangeEdit constructs a DocumentChange containing a // TextDocumentEdit from a file.Handle and a list of TextEdits. func DocumentChangeEdit(fh fileHandle, textedits []TextEdit) DocumentChange { … } // DocumentChangeCreate constructs a DocumentChange that creates a file. func DocumentChangeCreate(uri DocumentURI) DocumentChange { … } // DocumentChangeRename constructs a DocumentChange that renames a file. func DocumentChangeRename(src, dst DocumentURI) DocumentChange { … } // SelectCompletionTextEdit returns insert or replace mode TextEdit // included in the completion item. func SelectCompletionTextEdit(item CompletionItem, useReplaceMode bool) (TextEdit, error) { … }