Closed hhdqirui closed 1 year ago
Cannot reproduce.
Please provide more details and share your CompetiTest setup()
.
Below is my setup.
return {
{
'xeluxee/competitest.nvim',
dependencies = 'MunifTanjim/nui.nvim',
config = function()
require('competitest').setup({
runner_ui = {
interface = "split",
},
split_ui = {
position = "right",
relative_to_editor = false,
total_width = 0.3,
vertical_layout = {
{ 1, "tc" },
{ 1, { { 1, "so" }, { 1, "eo" } } },
{ 1, { { 1, "si" }, { 1, "se" } } },
},
total_height = 0.4,
horizontal_layout = {
{ 2, "tc" },
{ 3, { { 1, "so" }, { 1, "si" } } },
{ 3, { { 1, "eo" }, { 1, "se" } } },
},
},
view_output_diff = true,
receive_print_message = true,
template_file = {
cpp = "~/cp/template.cpp",
},
evaluate_template_modifiers = true,
received_files_extension = "cpp",
received_problems_prompt_path = false,
received_problems_path = function(task, file_extension)
local hyphen = string.find(task.group, " - ")
local judge, contest
if not hyphen then
judge = task.group
local slash = string.find(task.url, "/[^/]*$");
local name = string.sub(task.url, slash + 1, string.len(task.url))
return string.format("~/cp/%s/%s.%s", judge, name, file_extension)
else
judge = string.sub(task.group, 1, hyphen - 1)
contest = string.sub(task.group, hyphen + 3)
end
return string.format("~/cp/%s/%s/%s.%s", judge, contest, task.name, file_extension)
end,
})
end,
}
}
@xeluxee sorry, only setting received_problem_path
to a function will have this issue.
@hhdqirui your issue could be related to tilde. Replace this
return string.format("~/cp/%s/%s/%s.%s", judge, contest, task.name, file_extension)
with this
return string.format("%s/cp/%s/%s/%s.%s", vim.loop.os_homedir(), judge, contest, task.name, file_extension)
As README states, when received_problems_path
is a function it should return the absolute path to store received problem. Here tilde is recognized as a directory and files are stored there.
Thank you so much for your help! It works! Thank you for your plugin! It is great!
When
received_problems_path
is set to a string or function as shown in readme, the template file specified fortemplate_file
is not being used.