lsp: added delay to dynamic_output updates after a set_margin;
authorThomas Lindae <thomas.lindae@in.tum.de>
Thu, 16 May 2024 11:59:06 +0200
changeset 81041 b65931659364
parent 81040 d3e0d68c50d8
child 81042 f1e0ca5aaa6b
lsp: added delay to dynamic_output updates after a set_margin;
src/Tools/VSCode/src/dynamic_output.scala
src/Tools/VSCode/src/vscode_resources.scala
--- a/src/Tools/VSCode/src/dynamic_output.scala	Wed May 15 17:04:22 2024 +0200
+++ b/src/Tools/VSCode/src/dynamic_output.scala	Thu May 16 11:59:06 2024 +0200
@@ -96,6 +96,10 @@
   private val margin_ = Synchronized(None: Option[Double])
   def margin: Double = margin_.value.getOrElse(server.resources.message_margin)
 
+  private val delay_margin = Delay.last(server.resources.output_delay, server.channel.Error_Logger) {
+    handle_update(None, force = true)
+  }
+
   private def handle_update(restriction: Option[Set[Command]], force: Boolean = false): Unit = {
     val html_output = server.resources.html_output
     state.change(
@@ -127,6 +131,6 @@
 
   def set_margin(margin: Double): Unit = {
     margin_.change(_ => Some(margin))
-    handle_update(None, force = true)
+    delay_margin.invoke()
   }
 }
--- a/src/Tools/VSCode/src/vscode_resources.scala	Wed May 15 17:04:22 2024 +0200
+++ b/src/Tools/VSCode/src/vscode_resources.scala	Thu May 16 11:59:06 2024 +0200
@@ -84,6 +84,7 @@
   def html_output: Boolean = options.bool("vscode_html_output")
   def tooltip_margin: Int = options.int("vscode_tooltip_margin")
   def message_margin: Int = options.int("vscode_message_margin")
+  def output_delay: Time = options.seconds("vscode_output_delay")
 
 
   /* document node name */