public IReadOnlyList <KernelCommand> SplitSubmission(RequestDiagnostics requestDiagnostics) { var commands = SplitSubmission( requestDiagnostics, requestDiagnostics.Code, (languageNode, parent, _) => new RequestDiagnostics(languageNode, parent)); return(commands.Where(c => c is RequestDiagnostics).ToList()); }
public async Task HandleAsync( RequestDiagnostics command, KernelInvocationContext context) { var document = _workspace.UpdateWorkingDocument(command.Code); var semanticModel = await document.GetSemanticModelAsync(); var diagnostics = semanticModel.GetDiagnostics(); context.Publish(new DiagnosticsProduced(diagnostics.Select(Diagnostic.FromCodeAnalysisDiagnostic), command)); }
public async Task RequestCompletions_prevents_RequestDiagnostics_from_producing_events(Language language) { var kernel = CreateKernel(language); MarkupTestFile.GetLineAndColumn("Console.$$", out var output, out var line, out var column); var requestDiagnosticsCommand = new RequestDiagnostics(output); var results = await Task.WhenAll( kernel.SendAsync(new RequestCompletions(output, new LinePosition(line, column))), kernel.SendAsync(requestDiagnosticsCommand) ); var events = results.SelectMany(r => r.KernelEvents.ToSubscribedList()).ToList(); events.Select(e => e.GetType()) .Where(t => t == typeof(CommandSucceeded)).Should() .HaveCount(2); events.Should() .NotContain(e => e.GetType() == typeof(DiagnosticsProduced) && e.Command == requestDiagnosticsCommand); }
public void RequestDiagnostics_can_be_split_into_separate_commands() { var markupCode = @" #!time$$ // language-specific code"; MarkupTestFile.GetLineAndColumn(markupCode, out var code, out var startLineOfCode, out var _column); var sourceText = SourceText.From(code); var command = new RequestDiagnostics(code); var commands = new CSharpKernel().UseDefaultMagicCommands().SubmissionParser.SplitSubmission(command); commands .Should() .ContainSingle <RequestDiagnostics>() .Which .Code .Should() .NotContain("#!time"); }
public Task HandleAsync(RequestDiagnostics command, KernelInvocationContext context) => HandleRequestDiagnosticsAsync(command, context);
public Task HandleAsync(RequestDiagnostics command, KernelInvocationContext context) { return(SendCommandToRemoteKernel(command)); }