public override DocumentResults?ExecuteQuery(String input, String text) { try { context = new CompilationContext(workspace, document.WithText(SourceText.From(text))); var csharpBootStrapper = BootstrapperBuilder.Create(bootstrapper) .WithExecutor(new StandardExecutorWithContext(bootstrapper.RunnableManager, context)) .Build(); // var root = this.compiler.Parse(text); var response = input; // + " | convert-to-string"; var controlFlowDescriptor = csharpBootStrapper.Compiler.Parse(response); var controlFlow = csharpBootStrapper.ControlFlowFactory.Create(controlFlowDescriptor); var result = controlFlow.Execute(new[] { context.CurrentDocument.GetSyntaxRootAsync().Result }) as IEnumerable <Object>; var source = context.DocumentEditor.GetChangedDocument().GetSyntaxRootAsync().Result; var documentResults = new DocumentResults() { Source = source.ToFullString(), Results = String.Join(Environment.NewLine, result.OfType <SyntaxNode>().Select(node => node.ToFullString())) }; return(documentResults); } catch (Exception exception) { Console.WriteLine($"Error message: {exception.Message}"); Console.WriteLine("Stacktrace: "); Console.WriteLine(exception.StackTrace); return(null); } }
static int Main(string[] args) => BootstrapperBuilder.Create <BomToolBootstrapper>() .DetectQtRuntime() .EnableLogging(true) .SetStyle("Material") // set main ui qml file .SetMainQml(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Views", "Main.qml")) .Build() .Launch(args);