src/Tools/VSCode/src/server.scala
changeset 65922 d2f19f05c0e9
parent 65512 9fd620f2fa7d
child 65926 0f7821a07aa9
equal deleted inserted replaced
65921:5b42937d3b2d 65922:d2f19f05c0e9
    32       var dirs: List[Path] = Nil
    32       var dirs: List[Path] = Nil
    33       var logic = default_logic
    33       var logic = default_logic
    34       var modes: List[String] = Nil
    34       var modes: List[String] = Nil
    35       var options = Options.init()
    35       var options = Options.init()
    36       var system_mode = false
    36       var system_mode = false
       
    37       var verbose = false
    37 
    38 
    38       val getopts = Getopts("""
    39       val getopts = Getopts("""
    39 Usage: isabelle vscode_server [OPTIONS]
    40 Usage: isabelle vscode_server [OPTIONS]
    40 
    41 
    41   Options are:
    42   Options are:
    43     -d DIR       include session directory
    44     -d DIR       include session directory
    44     -l NAME      logic session name (default ISABELLE_LOGIC=""" + quote(default_logic) + """)
    45     -l NAME      logic session name (default ISABELLE_LOGIC=""" + quote(default_logic) + """)
    45     -m MODE      add print mode for output
    46     -m MODE      add print mode for output
    46     -o OPTION    override Isabelle system OPTION (via NAME=VAL or NAME)
    47     -o OPTION    override Isabelle system OPTION (via NAME=VAL or NAME)
    47     -s           system build mode for session image
    48     -s           system build mode for session image
       
    49     -v           verbose logging
    48 
    50 
    49   Run the VSCode Language Server protocol (JSON RPC) over stdin/stdout.
    51   Run the VSCode Language Server protocol (JSON RPC) over stdin/stdout.
    50 """,
    52 """,
    51         "L:" -> (arg => log_file = Some(Path.explode(File.standard_path(arg)))),
    53         "L:" -> (arg => log_file = Some(Path.explode(File.standard_path(arg)))),
    52         "d:" -> (arg => dirs = dirs ::: List(Path.explode(File.standard_path(arg)))),
    54         "d:" -> (arg => dirs = dirs ::: List(Path.explode(File.standard_path(arg)))),
    53         "l:" -> (arg => logic = arg),
    55         "l:" -> (arg => logic = arg),
    54         "m:" -> (arg => modes = arg :: modes),
    56         "m:" -> (arg => modes = arg :: modes),
    55         "o:" -> (arg => options = options + arg),
    57         "o:" -> (arg => options = options + arg),
    56         "s" -> (_ => system_mode = true))
    58         "s" -> (_ => system_mode = true),
       
    59         "v" -> (_ => verbose = true))
    57 
    60 
    58       val more_args = getopts(args)
    61       val more_args = getopts(args)
    59       if (more_args.nonEmpty) getopts.usage()
    62       if (more_args.nonEmpty) getopts.usage()
    60 
    63 
    61       val log = Logger.make(log_file)
    64       val log = Logger.make(log_file)
    62       val channel = new Channel(System.in, System.out, log)
    65       val channel = new Channel(System.in, System.out, log, verbose)
    63       val server = new Server(channel, options, logic, dirs, modes, system_mode, log)
    66       val server = new Server(channel, options, logic, dirs, modes, system_mode, log)
    64 
    67 
    65       // prevent spurious garbage on the main protocol channel
    68       // prevent spurious garbage on the main protocol channel
    66       val orig_out = System.out
    69       val orig_out = System.out
    67       try {
    70       try {