From 8c6db0bcc8596a24cf6b13cbaa4130367c9c2afd Mon Sep 17 00:00:00 2001 From: Dustin Broderick Date: Sat, 19 Nov 2016 21:23:54 -0700 Subject: [PATCH] Adds option to display results as blocks --- lib/package/config.coffee | 8 ++++++++ lib/runtime/evaluation.coffee | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/package/config.coffee b/lib/package/config.coffee index e1e02c76..0ecd2014 100644 --- a/lib/package/config.coffee +++ b/lib/package/config.coffee @@ -51,6 +51,14 @@ config = description: "Limits the Console history's size." default: 10000 order: 8 + resultsDisplayMode: + type: 'string' + default: 'inline' + enum: [ + {value:'inline', description:'Float results next to code'} + {value:'block', description:'Display results under code'} + ] + order: 10 if process.platform != 'darwin' config.terminal = diff --git a/lib/runtime/evaluation.coffee b/lib/runtime/evaluation.coffee index b3cc84e6..3b99c62b 100644 --- a/lib/runtime/evaluation.coffee +++ b/lib/runtime/evaluation.coffee @@ -23,12 +23,12 @@ module.exports = [[start], [end]] = range @ink.highlight editor, start, end r = null - setTimeout (=> r ?= new @ink.Result editor, [start, end]), 0.1 + setTimeout (=> r ?= new @ink.Result editor, [start, end], type: atom.config.get 'julia-client.resultsDisplayMode'), 0.1 evaluate({text, line: line+1, mod, path: edpath}) .then (result) => error = result.type == 'error' view = if error then result.view else result - if not r? or r.isDestroyed then r = new @ink.Result editor, [start, end] + if not r? or r.isDestroyed then r = new @ink.Result editor, [start, end], type: atom.config.get 'julia-client.resultsDisplayMode' registerLazy = (id) -> r.onDidDestroy client.withCurrent -> clearLazy [id] editor.onDidDestroy client.withCurrent -> clearLazy id