diff --git a/Sources/LanguageServerProtocol/General.swift b/Sources/LanguageServerProtocol/General.swift index 11d0e05..00a58e5 100644 --- a/Sources/LanguageServerProtocol/General.swift +++ b/Sources/LanguageServerProtocol/General.swift @@ -28,7 +28,7 @@ public struct InitializeParams: Codable, Hashable, Sendable { public let workspaceFolders: [WorkspaceFolder]? public init( - processId: Int, + processId: Int?, clientInfo: ClientInfo? = nil, locale: String?, rootPath: String?, diff --git a/Sources/LanguageServerProtocol/LanguageFeatures/Completion.swift b/Sources/LanguageServerProtocol/LanguageFeatures/Completion.swift index d07d475..bffdfe3 100644 --- a/Sources/LanguageServerProtocol/LanguageFeatures/Completion.swift +++ b/Sources/LanguageServerProtocol/LanguageFeatures/Completion.swift @@ -167,7 +167,7 @@ public struct CompletionItem: Codable, Hashable, Sendable { public let filterText: String? public let insertText: String? public let insertTextFormat: InsertTextFormat? - public let textEdit: TextEdit? + public let textEdit: TwoTypeOption? public let additionalTextEdits: [TextEdit]? public let commitCharacters: [String]? public let command: Command? @@ -184,7 +184,7 @@ public struct CompletionItem: Codable, Hashable, Sendable { filterText: String? = nil, insertText: String? = nil, insertTextFormat: InsertTextFormat? = nil, - textEdit: TextEdit? = nil, + textEdit: TwoTypeOption? = nil, additionalTextEdits: [TextEdit]? = nil, commitCharacters: [String]? = nil, command: Command? = nil, diff --git a/Sources/LanguageServerProtocol/TextSynchronization.swift b/Sources/LanguageServerProtocol/TextSynchronization.swift index d4100c6..45c8faa 100644 --- a/Sources/LanguageServerProtocol/TextSynchronization.swift +++ b/Sources/LanguageServerProtocol/TextSynchronization.swift @@ -102,6 +102,15 @@ public struct WillSaveTextDocumentParams: Codable, Hashable, Sendable { public typealias WillSaveWaitUntilResponse = [TextEdit]? +/// A special text edit to provide an insert and a replace operation. +/// +/// https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#insertReplaceEdit +public struct InsertReplaceEdit: Codable, Hashable, Sendable { + public let newText: String + public let insert: LSPRange + public let replace: LSPRange +} + public struct TextEdit: Codable, Hashable, Sendable { public let range: LSPRange public let newText: String