Commit graph

106 commits

Author SHA1 Message Date
Barrett Ruth
2d50f0a52a
refactor: remove open_url config option in favour of :CP open (#322)
## Problem

`open_url` automatically opened the browser on contest load and problem
change, which is now redundant with `:CP open`.

## Solution

Remove the `open_url` field from `cp.Config`, its default, its
validation, and the call site in `setup_contest`. Remove documentation
from `cp.nvim.txt`.
2026-03-05 22:55:43 -05:00
4f88b19a82 refactor(run): remove I/O view test navigation keymaps
Problem: <c-n>/<c-p> in the I/O view buffers required the cursor
to leave the source file to work, re-ran the solution on each
press, and gave no indication of which test was active. The
workflow is better served by :CP run <n> for a specific test or
:CP panel for full inspection.

Solution: remove navigate_test, next_test_key/prev_test_key config
options, and the associated current_test_index state field.
2026-03-04 00:26:22 -05:00
4e8da84882 feat(platforms): add kattis and usaco scrapers
Add KattisScraper and USACOScraper with contest list, metadata, and
test case fetching. Register kattis and usaco in PLATFORMS,
PLATFORM_DISPLAY_NAMES, and default platform configs.
2026-03-03 15:09:41 -05:00
72ea6249f4 ci: format 2026-03-03 00:46:59 -05:00
add022af8c refactor(hooks): replace flat hooks API with setup/on namespaces
Problem: the hooks API conflated distinct lifecycle scopes under a flat
table with inconsistent naming (setup_code, before_run, setup_io_input),
making it hard to reason about when each hook fires.

Solution: introduce two namespaces — hooks.setup.{contest,code,io} for
one-time initialization and hooks.on.{enter,run,debug} for recurring
events. hooks.setup.contest fires once when a contest dir is newly
created; hooks.on.enter is registered as a buffer-scoped BufEnter
autocmd and fires immediately after setup.code. The provisional buffer
setup_code callsite is removed as it ran on an unresolved temp buffer.
2026-03-03 00:46:59 -05:00
6a395af98f feat(config): add templates.cursor_marker for post-template cursor placement
Problem: after apply_template writes a file's content to the buffer,
cursor positioning was left entirely to the user's setup_code hook,
forcing everyone to reimplement the same placeholder-stripping logic.

Solution: add an optional templates.cursor_marker config key. When set,
apply_template scans the written lines for the marker, strips it, and
positions the cursor there via bufwinid so it works in both the
provisional and existing-file paths.
2026-03-03 00:46:59 -05:00
d3324aafa3 fix(config): propagate template through platform overrides
Problem: CpPlatformOverrides lacked a template field and merge_lang()
never copied ov.template into the effective language config, so
per-platform template overrides were silently dropped.

Solution: add template? to CpPlatformOverrides and forward it in
merge_lang(), matching how extension is handled.
2026-03-03 00:46:59 -05:00
e685a8089f feat: add epsilon tolerance for floating-point output comparison
Problem: output comparison used exact string equality after whitespace
normalisation, causing correct solutions to fail on problems where
floating-point answers are accepted within a tolerance (e.g. 1e-6).

Solution: add an optional ui.panel.epsilon config value. When set,
actual and expected output are compared token-by-token: numeric tokens
are compared with math.abs(a - b) <= epsilon, non-numeric tokens fall
back to exact string equality. Per-problem epsilon can also be stored
in the cache and takes precedence over the global default.
2026-02-26 23:00:35 -05:00
2c25ec616a feat: add per-language template file support
Problem: new solution files were always created empty, requiring users
to manually paste boilerplate or rely on editor snippets that fire
outside cp.nvim's control.

Solution: add an optional template field to the language config. When
set to a file path, its contents are written into every newly created
solution buffer before the setup_code hook runs. Existing files are
never overwritten.
2026-02-26 22:57:39 -05:00
06f72bbe2b fix: only show user-configured platforms in picker
Problem: tbl_deep_extend merges user platforms on top of defaults, so
all four default platforms survive even when the user only configures a
subset. The picker then shows platforms the user never intended to use.

Solution: before the deep merge, prune any default platform not present
in the user's platforms table. This preserves per-platform default
filling (the user doesn't have to re-specify every field) while ensuring
only explicitly configured platforms appear.
2026-02-18 17:29:41 -05:00
d496509fce feat(config): improve config parsing phrasing 2026-01-27 17:33:16 -05:00
383b327442 fix(config): validate scraper names better 2026-01-27 17:32:21 -05:00
3f677137de fix(config): one of validation 2026-01-27 17:27:15 -05:00
0a1cea9b43 feat: debug 2026-01-27 17:25:03 -05:00
d89a40b21f feat: update git formatting 2026-01-27 17:18:52 -05:00
Barrett Ruth
e89c2e1cf5 feat(codechef): finalize codechef impl 2025-10-25 01:41:55 -04:00
Barrett Ruth
181fff42de feat(ui): documentation for :CP edit abilities 2025-10-24 16:35:00 -04:00
Barrett Ruth
4b1b75fd6e fix(config): padding spacing 2025-10-24 14:44:33 -04:00
Barrett Ruth
f52244c534 better errors 2025-10-24 01:32:48 -04:00
Barrett Ruth
bd30fb626c feat: start lang refactor 2025-10-24 01:11:19 -04:00
Barrett Ruth
f715075dbe fix types 2025-10-24 00:34:42 -04:00
Barrett Ruth
249e84eb5a feat: customization 2025-10-24 00:26:14 -04:00
Barrett Ruth
9ffc285e16 feat: document bdingins 2025-10-23 23:45:05 -04:00
Barrett Ruth
6a6cf2c594 feat: bindings and --debug flag 2025-10-23 23:36:09 -04:00
Barrett Ruth
c312ccbb4d fix: highlighting 2025-10-23 18:16:36 -04:00
Barrett Ruth
13933fc7fd feat: clearcol 2025-10-23 12:10:14 -04:00
Barrett Ruth
114187164e improve some refactors 2025-10-23 11:16:13 -04:00
Barrett Ruth
018d801121 fix: rename run panel to panel 2025-10-23 09:54:55 -04:00
c0e175d84b feat(config): open url option 2025-10-12 16:19:02 -04:00
b68ecbbe96 rename and simplify things 2025-10-05 11:59:24 -04:00
d2bde9bad8 fix(config): better file org 2025-10-04 19:54:53 -04:00
a76d228e3f feat(doc): update for new config 2025-10-04 19:04:49 -04:00
aae98a5796 disable scraper disabling 2025-10-04 17:45:49 -04:00
0a320945a0 fix(config): platforms, not contests 2025-10-04 16:29:35 -04:00
3fbbfa9423 normalize scraper behavior 2025-10-04 16:13:04 -04:00
91dbc4560c fix(ci): unused var 2025-10-02 23:49:45 -04:00
cddd61f061 config hard fail 2025-10-02 23:20:51 -04:00
1974addbd2 fix(lua): bunch of typing 2025-10-02 14:18:26 -04:00
57be0c0044 remove keys 2025-10-02 10:23:01 -04:00
b406c0ce4e fix: synchronous problem fetch 2025-10-01 12:25:07 -04:00
46cd509747 fix docs and superfluous vim.validate calls 2025-09-30 20:55:29 -04:00
f0fbb15765 fix: default contest config 2025-09-26 09:28:23 -04:00
b41ed5be13 feat: provide default contest config 2025-09-26 09:15:43 -04:00
7efd6404b6 feat: interactive terminal 2025-09-26 08:28:19 -04:00
975e829f78 fix: remove version 2025-09-24 18:28:41 -04:00
9e84d57b8a feat: context, not config 2025-09-24 18:21:34 -04:00
5a6902633f refactor: massive file restructure 2025-09-22 19:00:36 -04:00
0851339e63 fix(diff): default to boring view 2025-09-21 17:19:34 -04:00
ff20efca71 feat(diff): third, regular diff mode 2025-09-21 17:18:22 -04:00
0a39a2e6a2 fix(test): proper picking 2025-09-21 15:15:04 -04:00