src/Tools/VSCode/src/server.scala
changeset 65189 41d2452845fc
parent 65184 0f555ce33970
child 65191 4c9c83311cad
equal deleted inserted replaced
65188:50cfc6775361 65189:41d2452845fc
   149       resources.change_model(session, file, change.text, change.range))
   149       resources.change_model(session, file, change.text, change.range))
   150     delay_input.invoke()
   150     delay_input.invoke()
   151     delay_output.invoke()
   151     delay_output.invoke()
   152   }
   152   }
   153 
   153 
       
   154 
       
   155   /* caret handling */
       
   156 
       
   157   private val delay_caret_update: Standard_Thread.Delay =
       
   158     Standard_Thread.delay_last(options.seconds("vscode_input_delay"), channel.Error_Logger)
       
   159     { session.caret_focus.post(Session.Caret_Focus) }
       
   160 
       
   161   private def update_caret(caret: Option[(JFile, Line.Position)])
       
   162   {
       
   163     resources.update_caret(caret)
       
   164     delay_caret_update.invoke()
       
   165   }
   154 
   166 
   155 
   167 
   156   /* output to client */
   168   /* output to client */
   157 
   169 
   158   private val delay_output: Standard_Thread.Delay =
   170   private val delay_output: Standard_Thread.Delay =
   360           case Protocol.DidCloseTextDocument(file) => close_document(file)
   372           case Protocol.DidCloseTextDocument(file) => close_document(file)
   361           case Protocol.Completion(id, node_pos) => completion(id, node_pos)
   373           case Protocol.Completion(id, node_pos) => completion(id, node_pos)
   362           case Protocol.Hover(id, node_pos) => hover(id, node_pos)
   374           case Protocol.Hover(id, node_pos) => hover(id, node_pos)
   363           case Protocol.GotoDefinition(id, node_pos) => goto_definition(id, node_pos)
   375           case Protocol.GotoDefinition(id, node_pos) => goto_definition(id, node_pos)
   364           case Protocol.DocumentHighlights(id, node_pos) => document_highlights(id, node_pos)
   376           case Protocol.DocumentHighlights(id, node_pos) => document_highlights(id, node_pos)
       
   377           case Protocol.Caret_Update(caret) => update_caret(caret)
   365           case _ => log("### IGNORED")
   378           case _ => log("### IGNORED")
   366         }
   379         }
   367       }
   380       }
   368       catch { case exn: Throwable => channel.log_error_message(Exn.message(exn)) }
   381       catch { case exn: Throwable => channel.log_error_message(Exn.message(exn)) }
   369     }
   382     }