src/Tools/VSCode/src/server.scala
changeset 64682 7e119f32276a
parent 64679 b2bf280b7e13
child 64683 c0c09b6dfbe0
equal deleted inserted replaced
64681:642b6105e6f4 64682:7e119f32276a
    25 
    25 
    26   val isabelle_tool = Isabelle_Tool("vscode_server", "VSCode Language Server for PIDE", args =>
    26   val isabelle_tool = Isabelle_Tool("vscode_server", "VSCode Language Server for PIDE", args =>
    27   {
    27   {
    28     try {
    28     try {
    29       var log_file: Option[Path] = None
    29       var log_file: Option[Path] = None
    30       var text_length = Length.encoding(default_text_length)
    30       var text_length = Text.Length.encoding(default_text_length)
    31       var dirs: List[Path] = Nil
    31       var dirs: List[Path] = Nil
    32       var logic = default_logic
    32       var logic = default_logic
    33       var modes: List[String] = Nil
    33       var modes: List[String] = Nil
    34       var options = Options.init()
    34       var options = Options.init()
    35 
    35 
    36       def text_length_choice: String =
    36       def text_length_choice: String =
    37         commas(Length.encodings.map(
    37         commas(Text.Length.encodings.map(
    38           { case (a, _) => if (a == default_text_length) a + " (default)" else a }))
    38           { case (a, _) => if (a == default_text_length) a + " (default)" else a }))
    39 
    39 
    40       val getopts = Getopts("""
    40       val getopts = Getopts("""
    41 Usage: isabelle vscode_server [OPTIONS]
    41 Usage: isabelle vscode_server [OPTIONS]
    42 
    42 
    49     -o OPTION    override Isabelle system OPTION (via NAME=VAL or NAME)
    49     -o OPTION    override Isabelle system OPTION (via NAME=VAL or NAME)
    50 
    50 
    51   Run the VSCode Language Server protocol (JSON RPC) over stdin/stdout.
    51   Run the VSCode Language Server protocol (JSON RPC) over stdin/stdout.
    52 """,
    52 """,
    53         "L:" -> (arg => log_file = Some(Path.explode(arg))),
    53         "L:" -> (arg => log_file = Some(Path.explode(arg))),
    54         "T:" -> (arg => Length.encoding(arg)),
    54         "T:" -> (arg => Text.Length.encoding(arg)),
    55         "d:" -> (arg => dirs = dirs ::: List(Path.explode(arg))),
    55         "d:" -> (arg => dirs = dirs ::: List(Path.explode(arg))),
    56         "l:" -> (arg => logic = arg),
    56         "l:" -> (arg => logic = arg),
    57         "m:" -> (arg => modes = arg :: modes),
    57         "m:" -> (arg => modes = arg :: modes),
    58         "o:" -> (arg => options = options + arg))
    58         "o:" -> (arg => options = options + arg))
    59 
    59 
    93 }
    93 }
    94 
    94 
    95 class Server(
    95 class Server(
    96   channel: Channel,
    96   channel: Channel,
    97   options: Options,
    97   options: Options,
    98   text_length: Length = Length.encoding(Server.default_text_length),
    98   text_length: Text.Length = Text.Length.encoding(Server.default_text_length),
    99   session_name: String = Server.default_logic,
    99   session_name: String = Server.default_logic,
   100   session_dirs: List[Path] = Nil,
   100   session_dirs: List[Path] = Nil,
   101   modes: List[String] = Nil)
   101   modes: List[String] = Nil)
   102 {
   102 {
   103   /* server state */
   103   /* server state */