public AltaxoCompilationResultWithAssembly Compile(Func <IEnumerable <string>, string> GetAssemblyNameFromCodeText, IEnumerable <System.Reflection.Assembly> references) { var scriptTexts = new string[] { Document.Text }; var assemblyName = GetAssemblyNameFromCodeText(scriptTexts); var result = Altaxo.CodeEditing.CompilationHandling.CompilationServiceStatic.GetCompilation(scriptTexts, assemblyName, references); if (result.CompiledAssembly != null) // Success { var diagsFiltered = result.Diagnostics.Where(diag => diag.Severity > 0).ToImmutableArray(); if (diagsFiltered.Length == 0) { _messageControl.SetMessages(ImmutableArray.Create(AltaxoDiagnostic.CreateInfoMessage("Compilation successful"))); } else { var arr = ImmutableArray.Create(AltaxoDiagnostic.CreateInfoMessage(string.Format("Compilation successful ({0} warnings)", diagsFiltered.Length))); arr = arr.AddRange(diagsFiltered); _messageControl.SetMessages(arr); } } else { _messageControl.SetMessages(result.Diagnostics); } return(result); }
private void EhDiagnosticClicked(AltaxoDiagnostic diag) { if (diag.Line.HasValue) { ActiveTextEditor.JumpTo(diag.Line.Value, diag.Column ?? 1); } }