Save multiline source in notebooks (#6445)

* Save multiline source in notebooks

* Stop demultiline localContentManager unnecessarily
This commit is contained in:
Chris LaFreniere
2019-07-26 10:30:52 -07:00
committed by GitHub
parent 5cffa7fe52
commit d51bdbd094
8 changed files with 153 additions and 13 deletions

View File

@@ -125,7 +125,7 @@ namespace v4 {
export function createDefaultCell(cell: nb.ICellContents): nb.ICellContents {
return {
cell_type: cell.cell_type,
source: demultiline(cell.source),
source: cell.source,
metadata: cell.metadata
};
}
@@ -133,7 +133,7 @@ namespace v4 {
function createCodeCell(cell: nb.ICellContents): nb.ICellContents {
return {
cell_type: cell.cell_type,
source: demultiline(cell.source),
source: cell.source,
metadata: cell.metadata,
execution_count: cell.execution_count,
outputs: createOutputs(cell)

View File

@@ -274,7 +274,7 @@ class SqlKernel extends Disposable implements nb.IKernel {
}
private getCodeWithoutCellMagic(content: nb.IExecuteRequest): string {
let code = content.code;
let code = Array.isArray(content.code) ? content.code.join('') : content.code;
let firstLineEnd = code.indexOf(os.EOL);
let firstLine = code.substring(0, (firstLineEnd >= 0) ? firstLineEnd : 0).trimLeft();
if (firstLine.startsWith('%%')) {