From d5b28c550a10cfdf082538f668a3dfcd288baff3 Mon Sep 17 00:00:00 2001 From: twio142 <64556708+twio142@users.noreply.github.com> Date: Thu, 2 Jun 2022 03:47:36 +0200 Subject: [PATCH] Add `selection` argument to `jsfile` It was only given to `jscommand`. --- main.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main.ts b/main.ts index b1efb55..bd5bd9b 100644 --- a/main.ts +++ b/main.ts @@ -562,9 +562,11 @@ export default class VimrcPlugin extends Plugin { } catch (e) { throw new Error(`Cannot read file ${params.args[0]} from vault root: ${e.message}`); } - const command = Function('editor', 'view', content + extraCode); + let currentSelections = this.currentSelection; + var chosenSelection = currentSelections[0]; + const command = Function('editor', 'view', 'selection', content + extraCode); const view = this.getActiveView(); - command(view.editor, view); + command(view.editor, view, chosenSelection); }); }