Skip to content

Commit

Permalink
Provide file context with inline evaluations
Browse files Browse the repository at this point in the history
Fixes #329
  • Loading branch information
PEZ committed Sep 20, 2019
1 parent d38b30b commit 9755fc3
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions calva/evaluate.ts
Expand Up @@ -42,9 +42,18 @@ async function evaluateSelection(document = {}, options = {}) {
let res = await client.eval("(in-ns '" + util.getNamespace(doc) + ")").value;

try {

let context = client.eval(code, { stdout: m => out.push(m), stderr: m => err.push(m), pprint: !!pprint })
let value = await context.value
const line = codeSelection.start.line,
column = codeSelection.start.character,
filePath = doc.fileName,
context = client.eval(code, {
file: filePath,
line: line,
column: column,
stdout: m => out.push(m),
stderr: m => err.push(m),
pprint: !!pprint
});
let value = await context.value;
value = context.pprintOut || value;

if (replace) {
Expand Down

0 comments on commit 9755fc3

Please sign in to comment.