From 77aab533dda78372ef8fc1f33d9c45fd20c9c41d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20J=C4=99drusiak?= <40692851+jakub-jedrusiak@users.noreply.github.com> Date: Wed, 1 Feb 2023 10:28:48 +0100 Subject: [PATCH] Ability to set echo=TRUE in run source by default (#1286) --- package.json | 5 +++++ src/rTerminal.ts | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/package.json b/package.json index 9cf5596e1..d6278cf7a 100644 --- a/package.json +++ b/package.json @@ -1576,6 +1576,11 @@ "default": "UTF-8", "markdownDescription": "An optional encoding to pass to R when executing the file, i.e. `source(FILE, encoding=ENCODING)`." }, + "r.source.echo": { + "type": "boolean", + "default": false, + "markdownDescription": "Should the file be executed with echo option set to TRUE by default, i.e. `source(FILE, echo=TRUE)`?" + }, "r.source.focus": { "type": "string", "default": "editor", diff --git a/src/rTerminal.ts b/src/rTerminal.ts index 38eeb71d9..ca8ad4966 100644 --- a/src/rTerminal.ts +++ b/src/rTerminal.ts @@ -30,7 +30,11 @@ export async function runSource(echo: boolean): Promise { return; } encodingParam = `encoding = "${encodingParam}"`; + const echoParam = util.config().get('source.echo'); rPath = [rPath, encodingParam].join(', '); + if (echoParam) { + echo = true; + } if (echo) { rPath = [rPath, 'echo = TRUE'].join(', '); }