Пример #1
0
 /// <summary>
 ///     Given a given snippets collection, constructs a new magic command
 ///     that queries callables defined in that snippets collection.
 /// </summary>
 public LsMagicMagic(IMagicSymbolResolver resolver, IExecutionEngine engine, ILogger <LsMagicMagic> logger) : base(
         "lsmagic",
         new Microsoft.Jupyter.Core.Documentation
 {
     Summary     = "Returns a list of all currently available magic commands.",
     Description = $@"
             This magic command lists all of the magic commands available in the IQ# kernel,
             as well as those defined in any packages that have been loaded in the current
             session via the [`%package` magic command]({KnownUris.ReferenceForMagicCommand("package")}).
         ".Dedent(),
     Examples    = new []
     {
         @"
                 Display the list of available magic commands:
                 ```
                 In []: %lsmagic
                 Out[]: <detailed list of all available magic commands>
                 ```
             ".Dedent(),
     }
 }, logger)
 {
     this.resolver = resolver;
     if (engine is IQSharpEngine iQSharpEngine)
     {
         iQSharpEngine.RegisterDisplayEncoder(new MagicSymbolSummariesToHtmlEncoder());
         iQSharpEngine.RegisterDisplayEncoder(new MagicSymbolSummariesToTextEncoder());
     }
     else
     {
         throw new Exception($"Expected execution engine to be an IQ# engine, but was {engine.GetType()}.");
     }
 }