Skip to content
Snippets Groups Projects
Commit c66e1dff authored by David Bühler's avatar David Bühler
Browse files

[server] New kernel request to save the current session.

parent 7736d378
No related branches found
No related tags found
No related merge requests found
...@@ -75,6 +75,15 @@ const load_internal: Server.SetRequest<string,string | undefined> = { ...@@ -75,6 +75,15 @@ const load_internal: Server.SetRequest<string,string | undefined> = {
/** Load a save file. Returns an error, if not successfull. */ /** Load a save file. Returns an error, if not successfull. */
export const load: Server.SetRequest<string,string | undefined>= load_internal; export const load: Server.SetRequest<string,string | undefined>= load_internal;
const save_internal: Server.SetRequest<string,string | undefined> = {
kind: Server.RqKind.SET,
name: 'kernel.services.save',
input: Json.jString,
output: Json.jString,
};
/** Save the current session. Returns an error, if not successfull. */
export const save: Server.SetRequest<string,string | undefined>= save_internal;
/** Source file positions. */ /** Source file positions. */
export type source = export type source =
{ dir: string, base: string, file: string, line: number }; { dir: string, base: string, file: string, line: number };
......
...@@ -74,6 +74,16 @@ let () = ...@@ -74,6 +74,16 @@ let () =
try Project.load_all (Filepath.Normalized.of_string file); None try Project.load_all (Filepath.Normalized.of_string file); None
with Project.IOError err -> Some err) with Project.IOError err -> Some err)
let () =
Request.register ~package ~kind:`SET ~name:"save"
~descr:(Md.plain "Save the current session. Returns an error, if not successfull.")
~input:(module Jstring)
~output:(module Joption(Jstring))
(fun file ->
try Project.save_all (Filepath.Normalized.of_string file); None
with Project.IOError err -> Some err)
(* -------------------------------------------------------------------------- *) (* -------------------------------------------------------------------------- *)
(* --- File Positions --- *) (* --- File Positions --- *)
(* -------------------------------------------------------------------------- *) (* -------------------------------------------------------------------------- *)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment