feat: remove default contest
This commit is contained in:
parent
d5395b20ab
commit
b679e2b932
5 changed files with 81 additions and 134 deletions
|
|
@ -10,6 +10,7 @@
|
|||
---@field height integer
|
||||
|
||||
local M = {}
|
||||
local languages = require("cp.languages")
|
||||
|
||||
function M.clearcol()
|
||||
vim.api.nvim_set_option_value("number", false, { scope = "local" })
|
||||
|
|
@ -78,7 +79,7 @@ function M.restore_layout(state, tile_fn)
|
|||
local source_file
|
||||
if source_files ~= "" then
|
||||
local files = vim.split(source_files, "\n")
|
||||
local valid_extensions = { "cc", "cpp", "cxx", "c", "py", "py3" }
|
||||
local valid_extensions = vim.tbl_keys(languages.filetype_to_language)
|
||||
for _, file in ipairs(files) do
|
||||
local ext = vim.fn.fnamemodify(file, ":e")
|
||||
if vim.tbl_contains(valid_extensions, ext) then
|
||||
|
|
@ -87,11 +88,9 @@ function M.restore_layout(state, tile_fn)
|
|||
end
|
||||
end
|
||||
source_file = source_file or files[1]
|
||||
else
|
||||
source_file = problem_id .. ".cc"
|
||||
end
|
||||
|
||||
if vim.fn.filereadable(source_file) == 0 then
|
||||
if not source_file or vim.fn.filereadable(source_file) == 0 then
|
||||
return
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue