Ejemplo n.º 1
0
        public static Task UseVSCodeHelpersAsync <TKernel>(this TKernel kernel, Kernel rootKernel) where TKernel : DotNetKernel
        {
            rootKernel.RegisterCommandType <GetInput>();
            KernelEventEnvelope.RegisterEvent <InputProduced>();

            var interactiveHost = new VSCodeInteractiveHost(rootKernel);

            return(kernel.SetVariableAsync("InteractiveHost", interactiveHost, typeof(IInteractiveHost)));
        }
Ejemplo n.º 2
0
        public static PowerShellKernel UseVSCodeHelpers(this PowerShellKernel kernel)
        {
            kernel.ReadInput    = prompt => Task.Run(() => VSCodeInteractiveHost.GetInputAsync(prompt: prompt)).Result;
            kernel.ReadPassword = prompt =>
            {
                var value = Task.Run(() => VSCodeInteractiveHost.GetInputAsync(prompt: prompt, isPassword: true)).Result;
                return(new PasswordString(value));
            };

            return(kernel);
        }