feat: problem statement panel #260

Closed
opened 2026-02-27 00:20:56 +00:00 by barrettruth · 1 comment
barrettruth commented 2026-02-27 00:20:56 +00:00

Problem

cp.nvim has open_url = true which opens the problem page in a browser. This requires context-switching out of Neovim. No CP tool currently renders the problem statement within Neovim itself, which would be a meaningful differentiator.

Proposed solution

Extend the Python scrapers to extract the problem statement as Markdown (in addition to test cases) and cache it. Add a :CP statement command that opens the Markdown content in a floating or split buffer.

The statement buffer could use render-markdown.nvim (if installed) for rendering, falling back to plain Markdown text. The Competitive Companion JSON payload also contains a url field which could support fetching via pandoc or similar for platforms not in the scraper set.

Configuration:

statement = {
  enabled = true,
  width = 0.45,     -- float window width ratio
  renderer = nil,   -- nil | "render-markdown" | custom function
}

Alternatives considered

  • Continuing to use open_url + browser (current approach, no Neovim integration)
  • Embedding a browser engine (too heavy, not Neovim-idiomatic)
  • vim.ui.open for the URL (same as current, no rendering)

The scraper-based approach is the most self-contained and works offline with cached data.

## Problem cp.nvim has `open_url = true` which opens the problem page in a browser. This requires context-switching out of Neovim. No CP tool currently renders the problem statement within Neovim itself, which would be a meaningful differentiator. ## Proposed solution Extend the Python scrapers to extract the problem statement as Markdown (in addition to test cases) and cache it. Add a `:CP statement` command that opens the Markdown content in a floating or split buffer. The statement buffer could use `render-markdown.nvim` (if installed) for rendering, falling back to plain Markdown text. The Competitive Companion JSON payload also contains a `url` field which could support fetching via `pandoc` or similar for platforms not in the scraper set. Configuration: ```lua statement = { enabled = true, width = 0.45, -- float window width ratio renderer = nil, -- nil | "render-markdown" | custom function } ``` ## Alternatives considered - Continuing to use `open_url` + browser (current approach, no Neovim integration) - Embedding a browser engine (too heavy, not Neovim-idiomatic) - `vim.ui.open` for the URL (same as current, no rendering) The scraper-based approach is the most self-contained and works offline with cached data.
barrettruth commented 2026-02-27 00:25:43 +00:00

NOTE: I don't really like this at all

NOTE: I don't really like this at all
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
barrettruth/cp.nvim#260
No description provided.