--- a/src/Tools/VSCode/src/lsp.scala Sun Jun 30 15:32:51 2024 +0200
+++ b/src/Tools/VSCode/src/lsp.scala Sun Jun 30 15:22:36 2024 +0200
@@ -328,11 +328,15 @@
def json: JSON.T = JSON.Object("range" -> Range(range), "newText" -> new_text)
}
- sealed case class TextDocumentEdit(file: JFile, version: Long, edits: List[TextEdit]) {
+ sealed case class TextDocumentEdit(file: JFile, version: Option[Long], edits: List[TextEdit]) {
def json: JSON.T =
JSON.Object(
- "textDocument" -> JSON.Object("uri" -> Url.print_file(file), "version" -> version),
- "edits" -> edits.map(_.json))
+ "textDocument" -> (
+ JSON.Object("uri" -> Url.print_file(file)) ++
+ JSON.optional("version" -> version)
+ ),
+ "edits" -> edits.map(_.json)
+ )
}
object WorkspaceEdit {