feat(commands): implement :CP open [problem|contest|standings]
Problem: There was no way to open a problem or contest page in the browser from within the plugin; users had to manually navigate to the platform URL. Solution: Add `contest_url` and `standings_url` to `MetadataResult` and persist them via `cache.set_contest_data`. Add `cache.get_open_urls` to assemble all three URLs from cache. Wire up `:CP open` in `commands/init.lua` to call `vim.ui.open` on the resolved URL, warning when none is available (e.g. CSES standings).
This commit is contained in:
parent
cc48c901c0
commit
cc279166cb
8 changed files with 65 additions and 2 deletions
|
|
@ -243,7 +243,14 @@ function M.setup_contest(platform, contest_id, problem_id, language)
|
|||
contest_id,
|
||||
vim.schedule_wrap(function(result)
|
||||
local problems = result.problems or {}
|
||||
cache.set_contest_data(platform, contest_id, problems, result.url)
|
||||
cache.set_contest_data(
|
||||
platform,
|
||||
contest_id,
|
||||
problems,
|
||||
result.url,
|
||||
result.contest_url or '',
|
||||
result.standings_url or ''
|
||||
)
|
||||
local prov = state.get_provisional()
|
||||
if not prov or prov.platform ~= platform or prov.contest_id ~= contest_id then
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue