-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support Iron.nvim and user functions for sending code to REPL (#…
…109) --------- Co-authored-by: Jannik Buhr <[email protected]>
- Loading branch information
Showing
6 changed files
with
54 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
local concat = require('quarto.tools').concat | ||
local iron_send = require("iron.core").send | ||
|
||
---Run the code cell with iron | ||
---@param cell CodeCell | ||
---@param _ boolean | ||
local function run(cell, _) | ||
local text_lines = concat(cell.text) | ||
local lang = cell.lang or "quarto" | ||
-- forward to iron.send | ||
-- first arg is filetype. if not supplied, iron.core.send would infer "quarto". | ||
-- Iron lets the user map a filetype to a repl binary, e.g. {"python" = "ipython", "r" = "radian"} | ||
-- so we can pass the cell.lang to get the same feel from a .qmd file. | ||
iron_send(lang, text_lines) | ||
end | ||
|
||
---@class CodeRunner | ||
local M = { run = run } | ||
|
||
return M | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters