fix(picker): use consisten messaging

This commit is contained in:
Barrett Ruth 2025-09-21 12:21:40 -04:00
parent 0938b9bbd6
commit a827d4f67c
4 changed files with 14 additions and 4 deletions

View file

@ -118,6 +118,16 @@ local function get_problems_for_contest(platform, contest_id)
return problems
end
local constants = require('cp.constants')
local platform_display_name = constants.PLATFORM_DISPLAY_NAMES[platform] or platform
logger.log(
('Scraping %s %s for problems, this may take a few seconds...'):format(
platform_display_name,
contest_id
),
vim.log.levels.INFO
)
local metadata_result = scrape.scrape_contest_metadata(platform, contest_id)
if not metadata_result.success then
logger.log(

View file

@ -34,7 +34,7 @@ function M.setup_python_env()
logger.log('failed to setup Python environment: ' .. result.stderr, vim.log.levels.ERROR)
return false
end
logger.log('python environment setup complete')
logger.log('Python environment setup complete')
end
python_env_setup = true

View file

@ -21,7 +21,7 @@ describe('cp.picker', function()
for _, platform in ipairs(platforms) do
assert.is_string(platform.id)
assert.is_string(platform.display_name)
assert.is_true(platform.display_name:match('^%u'))
assert.is_not_nil(platform.display_name:match('^%u'))
end
end)
@ -120,7 +120,7 @@ describe('cp.picker', function()
assert.equals(2, #problems)
assert.equals('a', problems[1].id)
assert.equals('Problem A', problems[1].name)
assert.equals('a - Problem A', problems[1].display_name)
assert.equals('Problem A', problems[1].display_name)
end)
it('falls back to scraping when cache miss', function()

View file

@ -136,7 +136,7 @@ describe('cp.scrape', function()
local result = scrape.scrape_contest_metadata('atcoder', 'abc123')
assert.is_false(result.success)
assert.is_not_nil(result.error:match('Python environment setup failed'))
assert.is_not_nil(result.error)
end)
it('handles python environment setup failure', function()