Skip to content

Commit

Permalink
fix: detect end of Rnoweb with '^@' instead of '@'
Browse files Browse the repository at this point in the history
Also some minor refactoring elsewhere
wurli committed Mar 27, 2024
1 parent 13dc646 commit 011c2f5
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lua/r/send.lua
Original file line number Diff line number Diff line change
@@ -31,7 +31,7 @@ local ensure_ts_parser_exists = function(txt, row)
chunk_end_pattern = chunk_start_pattern
elseif vim.o.filetype == "rnoweb" then
chunk_start_pattern = "^<<"
chunk_end_pattern = "@"
chunk_end_pattern = "^@"
else
return
end
@@ -84,16 +84,16 @@ local function get_code_to_send(txt, row)
bufnr = 0,
pos = { row - 1, col - 1 },
lang = "r",
-- Required for quart/rmd/rnoweb where we need to inject a parser
-- Required for quarto/rmd/rnoweb where we need to inject a parser
ignore_injections = vim.o.filetype == "r",
})

local root_nodes = {
["program"] = true,
["brace_list"] = true,
}
local is_root = function(n)
local terminating_nodes = {
["program"] = true,
["brace_list"] = true,
}
return terminating_nodes[n:type()] == true
return root_nodes[n:type()] == true
end

while true do

0 comments on commit 011c2f5

Please sign in to comment.