Skip to content

Commit

Permalink
TypeScript updates for contract changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jonsequitur committed Sep 14, 2022
1 parent a514522 commit d80ec92
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 8 deletions.
2 changes: 0 additions & 2 deletions src/Microsoft.DotNet.Interactive.Documents/CodeSubmission.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,6 @@ public static string ToCodeSubmissionContent(
this InteractiveDocument document,
string newline = "\n")
{
// FIX: (ToCodeSubmissionContent) stringbuilderify this

var lines = new List<string>();

if (document.Metadata.Count > 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class NotebookParserServer {
// ensure at least one cell
notebookCells.push({
executionOrder: 0,
language: defaultNotebookCellLanguage,
kernelName: defaultNotebookCellLanguage,
contents: '',
outputs: [],
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export function toNotebookDocument(document: vscode.NotebookDocument): Interacti
export function toInteractiveDocumentElement(cell: vscode.NotebookCell): InteractiveDocumentElement {
return {
executionOrder: cell.executionSummary?.executionOrder ?? 0,
language: cell.kind === vscode.NotebookCellKind.Code
kernelName: cell.kind === vscode.NotebookCellKind.Code
? getSimpleLanguage(cell.document.languageId)
: 'markdown',
contents: cell.document.getText(),
Expand Down
6 changes: 3 additions & 3 deletions src/dotnet-interactive-vscode/src/notebookSerializers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function toInteractiveDocumentElement(cell: vscode.NotebookCellData): contracts.
const outputs = cell.outputs || [];
return {
executionOrder: cell.executionSummary?.executionOrder ?? 0,
language: getSimpleLanguage(cell.languageId),
kernelName: getSimpleLanguage(cell.languageId),
contents: cell.value,
outputs: outputs.map(vsCodeCellOutputToContractCellOutput)
};
Expand Down Expand Up @@ -61,9 +61,9 @@ export function createAndRegisterNotebookSerializers(context: vscode.ExtensionCo

function toVsCodeNotebookCellData(cell: contracts.InteractiveDocumentElement): vscode.NotebookCellData {
const cellData = new vscode.NotebookCellData(
<number>languageToCellKind(cell.language),
<number>languageToCellKind(cell.kernelName),
cell.contents,
getNotebookSpecificLanguage(cell.language));
getNotebookSpecificLanguage(cell.kernelName));
cellData.outputs = cell.outputs.map(outputElementToVsCodeCellOutput);
return cellData;
}
Expand Down
2 changes: 1 addition & 1 deletion src/microsoft-dotnet-interactive/src/contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ export interface InteractiveDocument {

export interface InteractiveDocumentElement {
id?: string;
language?: string;
kernelName?: string;
contents: string;
outputs: Array<InteractiveDocumentOutputElement>;
executionOrder: number;
Expand Down

0 comments on commit d80ec92

Please sign in to comment.