public static IReadOnlyCollection <SerializableDiagnostic> ExtractSerializableDiagnosticsFromSemanticModel( BufferId bufferId, Budget budget, SemanticModel semanticModel, Workspace workspace) { var diagnostics = workspace.MapDiagnostics(bufferId, semanticModel.GetDiagnostics().ToArray(), budget); return(diagnostics.DiagnosticsInActiveBuffer); }
private async Task <(IReadOnlyCollection <SerializableDiagnostic> DiagnosticsInActiveBuffer, IReadOnlyCollection <SerializableDiagnostic> AllDiagnostics)> ExtractDiagnostics( Workspace workspace, BufferId activeBufferId, ScriptOptions options) { workspace = await _transformer.TransformAsync(workspace); var sourceFile = workspace.GetSourceFiles().Single(); var code = sourceFile.Text.ToString(); var compilation = CSharpScript.Create(code, options).GetCompilation(); return(workspace.MapDiagnostics( activeBufferId, compilation.GetDiagnostics())); }
private async Task <CompileWorkerResult> CompileWorker( Workspace workspace, BufferId activeBufferId, Budget budget) { var package = await _packageFinder.Find <Package>(workspace.WorkspaceType); workspace = await _transformer.TransformAsync(workspace); var compilation = await package.Compile(workspace, budget, activeBufferId); var(diagnosticsInActiveBuffer, allDiagnostics) = workspace.MapDiagnostics(activeBufferId, compilation.GetDiagnostics()); budget.RecordEntryAndThrowIfBudgetExceeded(); return(new CompileWorkerResult( compilation, diagnosticsInActiveBuffer, allDiagnostics)); }
private async Task <CompileWorkerResult> CompileWorker( Workspace workspace, BufferId activeBufferId, Budget budget) { var package = await _packageFinder.Find <ICreateWorkspace>(workspace.WorkspaceType); workspace = await workspace.InlineBuffersAsync(); var sources = workspace.GetSourceFiles(); var(compilation, documents) = await package.GetCompilation(sources, SourceCodeKind.Regular, workspace.Usings, () => package.CreateRoslynWorkspaceAsync(budget), budget); var(diagnosticsInActiveBuffer, allDiagnostics) = workspace.MapDiagnostics(activeBufferId, compilation.GetDiagnostics()); budget.RecordEntryAndThrowIfBudgetExceeded(); return(new CompileWorkerResult( compilation, diagnosticsInActiveBuffer, allDiagnostics)); }