Skip to content

Commit

Permalink
prepare v1.1.1 by removing variables
Browse files Browse the repository at this point in the history
  • Loading branch information
badetitou committed Oct 13, 2021
1 parent 2d596c8 commit 466c117
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 18 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v1.1.1

- Fix MooseBook to display errors

## v1.1.0

Support of MooseBook
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Highlighting, Auto-completion, Execution, ...",
"author": "Benoît Verhaeghe",
"license": "MIT",
"version": "1.1.0",
"version": "1.1.1",
"icon": "icon.png",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion samples/moose.moosebook
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"kind":1,"language":"markdown","value":"Hello"},{"kind":2,"language":"pharo","value":"self inform: 'hello'"},{"kind":2,"language":"pharo","value":"hello := 3.\nhello := hello + 1.\nhello"}]
[{"kind":1,"language":"markdown","value":"Hello"},{"kind":2,"language":"pharo","value":"test := Object new."},{"kind":2,"language":"pharo","value":""},{"kind":2,"language":"pharo","value":"hello"}]
29 changes: 15 additions & 14 deletions src/moosebook/MoosebookController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,22 @@ export class MoosebookController {
const execution = this._controller.createNotebookCellExecution(cell);
execution.executionOrder = ++this._executionOrder;
execution.start(Date.now()); // Keep track of elapsed time to execute cell.
let output = {mimetype: 'text/html', content: 'error... '};
output = await client.sendRequest('command:notebookPrintIt', { "line": cell.document.getText() }).then((result: PharoResponse) => {
if (result.mimetype == 'error')
await client.sendRequest('command:notebookPrintIt', { "line": cell.document.getText() }).then((result: PharoResponse) => {
if (result.mimetype == 'error') {
throw new Error(result.content);
return result;
}).catch((error) => {
throw new Error(error);
});


execution.replaceOutput([
new NotebookCellOutput([
NotebookCellOutputItem.text(output.content, output.mimetype)
}
execution.replaceOutput([
new NotebookCellOutput([
NotebookCellOutputItem.text(result.content, result.mimetype)
])
]);
execution.end(true, Date.now());
}).catch((err) => {
execution.replaceOutput([new NotebookCellOutput([
NotebookCellOutputItem.error(err)
])
]);
execution.end(true, Date.now());
]);
execution.end(false, Date.now());
});
}
}

0 comments on commit 466c117

Please sign in to comment.