这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Developer-guide.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
},
"outputs": [],
"source": [
"Invoke-Expression \"$dotnetInteractiveRepoPath/repack.ps1\""
"Invoke-Expression \"$dotnetInteractiveRepoPath\\repack.ps1\""
]
},
{
Expand All @@ -102,6 +102,8 @@
},
"outputs": [],
"source": [
"$tryDotnetRepoPath = Get-Location\n",
"\n",
"$nugetConfigPath = Join-Path $tryDotnetRepoPath 'NuGet.config'\n",
"[xml]$nugetConfig = Get-Content $nugetConfigPath\n",
"\n",
Expand Down Expand Up @@ -183,7 +185,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## 2.1: Clone and build Try .NET"
"## 2.1: Build Try .NET"
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.3" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.3" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.3" />
<PackageVersion Include="Microsoft.DotNet.Interactive.CSharpProject" Version="1.0.0-beta.24224.2" />
<PackageVersion Include="Microsoft.DotNet.Interactive.CSharpProject" Version="1.0.0-beta.24229.3" />
<PackageVersion Include="Microsoft.Playwright" Version="1.42.0" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="peaky.client" Version="4.0.79" />
<PackageVersion Include="peaky.xunit" Version="4.0.79" />
<PackageVersion Include="Peaky" Version="4.0.81-beta" />
<PackageVersion Include="Peaky" Version="4.0.83-beta" />
<PackageVersion Include="Pocket.Disposable" Version="1.2.0" />
<PackageVersion Include="PocketLogger.For.Xunit" Version="0.9.0" />
<PackageVersion Include="PocketLogger.Subscribe" Version="0.9.0" />
Expand Down
604 changes: 7 additions & 597 deletions PeakyTests.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/Microsoft.TryDotNet.IntegrationTests/EditorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ static void Main() {{
.GetProperty("output")
.GetRawText()
.Should()
.Contain($"[\"{randomValue}\\n\",\"{randomValue}a\\n\",\"{randomValue}b\\n\"]");
.Contain($"{randomValue}\\n{randomValue}a\\n{randomValue}b\\n");
}

[IntegrationTestFact]
Expand Down
8 changes: 5 additions & 3 deletions src/Microsoft.TryDotNet/KernelDiagnostics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System.Diagnostics;
using Microsoft.DotNet.Interactive;
using Microsoft.DotNet.Interactive.Formatting;
using Pocket;

namespace Microsoft.TryDotNet;
Expand Down Expand Up @@ -34,9 +35,10 @@ public static T LogEventsToPocketLogger<T>(this T kernel)
disposables.Add(
k.KernelEvents.Subscribe(e =>
{
Logger.Log.Info("{kernel}: {event}",
k.Name,
e);
Logger.Log.Info("{kernel}: {event} ({details})",
k.Name,
e,
e.ToDisplayString("text/plain"));
}));
});

Expand Down
64 changes: 0 additions & 64 deletions src/Microsoft.TryDotNet/PeakyTestPageRenderer.cs

This file was deleted.

5 changes: 0 additions & 5 deletions src/Microsoft.TryDotNet/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,6 @@ public static async Task<WebApplication> CreateWebApplicationAsync(WebApplicatio

_consolePrebuild = await Prebuild.GetOrCreateConsolePrebuildAsync(enableBuild: false);

builder.Services.AddTransient<ITestPageRenderer>(provider =>
{
return new PeakyTestPageRenderer(provider);
});

switch (Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"))
{
case "Development":
Expand Down
2 changes: 1 addition & 1 deletion src/microsoft-trydotnet-editor/src/EditorAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import * as polyglotNotebooks from '@microsoft/polyglot-notebooks';
import * as rxjs from 'rxjs';
import { DebouncingKernel } from './decouncingKernel';
import { DebouncingKernel } from './debouncingKernel';

export enum MarkerSeverity {
Hint = 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,6 @@ export class ProjectKernelWithWASMRunner extends projectKernel.ProjectKernel {
private forwardEvents(eventEnvelopes: Array<polyglotNotebooks.KernelEventEnvelope>, rootCommand: polyglotNotebooks.KernelCommandEnvelope, invocationContext: polyglotNotebooks.KernelInvocationContext) {
for (let eventEnvelope of eventEnvelopes) {
const eventType = eventEnvelope.eventType;
const eventCommandType = eventEnvelope.command.commandType;
const eventCommandToken = eventEnvelope.command.getOrCreateToken();

const rootCommandType = rootCommand.commandType;
const rootCommandToken = rootCommand.getOrCreateToken();

if (eventType === polyglotNotebooks.CommandFailedType) {
polyglotNotebooks.Logger.default.error(`[ProjectKernelWithWASMRunner] command failed: ${JSON.stringify(eventEnvelope)}`);
Expand All @@ -190,7 +185,7 @@ export class ProjectKernelWithWASMRunner extends projectKernel.ProjectKernel {
else if (eventType === polyglotNotebooks.CommandSucceededType) {
continue;
}
else if (eventCommandType === rootCommandType) {
else {
// todo: do we need processing this?
const event = polyglotNotebooks.KernelEventEnvelope.fromJson({
...eventEnvelope.toJson
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class CommandOperation {

export class DebouncingKernel {

private _langiageServicesCommandOperation: CommandOperation = null;
private _languageServicesCommandOperation: CommandOperation = null;
private _commandOperations: CommandOperation[] = [];
private _running: boolean = false;

Expand Down Expand Up @@ -49,22 +49,22 @@ export class DebouncingKernel {
case polyglotNotebooks.RequestCompletionsType:
case polyglotNotebooks.RequestHoverTextType:
case polyglotNotebooks.RequestSignatureHelpType:
this._langiageServicesCommandOperation?.cancel();
this._langiageServicesCommandOperation = newOperation;
this._languageServicesCommandOperation?.cancel();
this._languageServicesCommandOperation = newOperation;
break;
case polyglotNotebooks.RequestDiagnosticsType:
if (this._langiageServicesCommandOperation) {
switch (this._langiageServicesCommandOperation.kernelCommandEnvelope.commandType) {
if (this._languageServicesCommandOperation) {
switch (this._languageServicesCommandOperation.kernelCommandEnvelope.commandType) {
case polyglotNotebooks.RequestDiagnosticsType:
this._langiageServicesCommandOperation?.cancel();
this._langiageServicesCommandOperation = newOperation;
this._languageServicesCommandOperation?.cancel();
this._languageServicesCommandOperation = newOperation;
break;
default:
this._commandOperations.push(newOperation);
break;
}
} else {
this._langiageServicesCommandOperation = newOperation;
this._languageServicesCommandOperation = newOperation;
}
break;
default:
Expand All @@ -81,11 +81,11 @@ export class DebouncingKernel {
async executionLoop() {
this._running = true;

while (this._langiageServicesCommandOperation || this._commandOperations.length > 0) {
while (this._languageServicesCommandOperation || this._commandOperations.length > 0) {
{
if (this._langiageServicesCommandOperation) {
const local = this._langiageServicesCommandOperation;
this._langiageServicesCommandOperation = null;
if (this._languageServicesCommandOperation) {
const local = this._languageServicesCommandOperation;
this._languageServicesCommandOperation = null;
await this._kernel.send(local.kernelCommandEnvelope).then(() => {
local.complete();
}).catch(r => local.completionSource.reject(r));
Expand Down
27 changes: 16 additions & 11 deletions src/microsoft-trydotnet-editor/src/tryDotNetEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import * as polyglotNotebooks from '@microsoft/polyglot-notebooks';
import * as newContract from './newContract';
import { DocumentId } from './documentId';
import { configureLogging } from './log';
import { DebouncingKernel } from './decouncingKernel';
import { DebouncingKernel } from './debouncingKernel';

export class TryDotNetEditor {
private _editor?: monaco.EditorAdapter;
Expand Down Expand Up @@ -180,7 +180,6 @@ export class TryDotNetEditor {
message.regionName = documentOpened.regionName;
}
this._postMessage(message);

}
break;
case messages.FOCUS_EDITOR_REQUEST:
Expand Down Expand Up @@ -240,18 +239,22 @@ export class TryDotNetEditor {
};

try {
if (event.eventType === polyglotNotebooks.CommandFailedType) {
response.exception = (<polyglotNotebooks.CommandFailed>event.event).message;
}
const stdOutEvents = events.filter(e => e.eventType === polyglotNotebooks.StandardOutputValueProducedType).map(e => (<polyglotNotebooks.StandardOutputValueProduced>e.event));
response.exception = [];

response.output = stdOutEvents.map(e => e.formattedValues[0].value);
const stdOutEvents = events
.filter(e => e.eventType === polyglotNotebooks.StandardOutputValueProducedType)
.map(e => (<polyglotNotebooks.StandardOutputValueProduced>e.event));

const diagnosticsEvents = events.filter(e => e.eventType === polyglotNotebooks.DiagnosticsProducedType).map(e => (<polyglotNotebooks.DiagnosticsProduced>e.event));
const diagnosticsEvents = events
.filter(e => e.eventType === polyglotNotebooks.DiagnosticsProducedType)
.map(e => (<polyglotNotebooks.DiagnosticsProduced>e.event));

response.output = [stdOutEvents.map(e => e.formattedValues[0].value).join('')];

response.diagnostics = [];
for (let diagnosticsEvent of diagnosticsEvents) {
for (let diagnostic of diagnosticsEvent.diagnostics) {
response.exception.push(diagnostic.message);
response.diagnostics.push({
start: diagnostic.linePositionSpan.start,
end: diagnostic.linePositionSpan.end,
Expand All @@ -260,6 +263,10 @@ export class TryDotNetEditor {
});
}
}

if (response.exception.length === 0) {
response.exception = null;
}
}
finally {
this._postMessage(response);
Expand All @@ -271,9 +278,7 @@ export class TryDotNetEditor {
}
break;
default:
if (event.command.commandType === polyglotNotebooks.SubmitCodeType) {
events.push(event);
}
events.push(event);
break;
}
});
Expand Down
2 changes: 1 addition & 1 deletion src/microsoft-trydotnet/src/internals/executionService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ enum executionServiceStates {
ready,
running
}
export class executionService implements Subscribable<OutputEvent>{
export class executionService implements Subscribable<OutputEvent> {
private state: executionServiceStates = executionServiceStates.ready;
private outputEventChannel: Subject<OutputEvent> = new Subject<OutputEvent>();
private currentRun: { requestId: string, request: Promise<RunResult> };
Expand Down
3 changes: 1 addition & 2 deletions src/microsoft-trydotnet/src/internals/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ export class Workspace {
requestId: requestId,
project: prjr.project,
}
let messageBus = this.projectApiMessageBus;

let messageBus = this.projectApiMessageBus;

let projectOpenedPromise = responseFor<newContract.ProjectOpened>(messageBus, polyglotNotebooks.ProjectOpenedType, requestId, response => {

Expand Down Expand Up @@ -182,7 +182,6 @@ export class Workspace {
this._currentOpenDocument = document;
}


return document;
}

Expand Down