コード例 #1
0
        public static FSharpKernel UseVSCodeHelpers(this FSharpKernel kernel)
        {
            var command = new SubmitCode($@"
#r ""{typeof(VSCodeInteractiveHost).Assembly.Location.Replace("\\", "/")}""

[<AutoOpen>]
module VSCodeTopLevelModule =
    let GetInputAsync ( prompt : string ) ( isPassword : bool) = 
        {typeof(VSCodeInteractiveHost).FullName}.{nameof(VSCodeInteractiveHost.GetInputAsync)}( prompt, isPassword ) |> Async.AwaitTask
");

            kernel.DeferCommand(command);
            return(kernel);
        }
コード例 #2
0
        public static FSharpKernel UseMathAndLaTeX(this FSharpKernel kernel)
        {
            if (kernel is null)
            {
                throw new ArgumentNullException(nameof(kernel));
            }

            kernel.DeferCommand(
                new SubmitCode($@"
#r ""{typeof(LaTeXString).Assembly.Location.Replace("\\", "/")}""
open {typeof(LaTeXString).Namespace}
"));

            return(kernel);
        }