Skip to content

Commit

Permalink
feat: show icons for concept and practice
Browse files Browse the repository at this point in the history
  • Loading branch information
2KAbhishek committed Nov 21, 2024
1 parent 1f134d0 commit 1736e8e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lua/exercism/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ local config = {
name = 'World!',
add_default_keybindings = true,
exercism_workspace = '~/exercism',
icons = {
concept = '',
practice = '',
}
}

---@type exercism.config
Expand Down
7 changes: 6 additions & 1 deletion lua/exercism/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ local config = require('exercism.config').config
---@class exercism.main
local M = {}

local type_icons_map = {
['concept'] = config.icons.concept .. ' ',
['practice'] = config.icons.practice .. ' ',
}

---@param language string
---@return any
local function get_exercise_data(language)
Expand All @@ -30,7 +35,7 @@ M.list_exercises = function(language)
vim.ui.select(exercise_data, {
prompt = 'Select Exercise (' .. language .. ')',
format_item = function(exercise)
return exercise.name .. ' : ' .. exercise.type
return type_icons_map[exercise.type] .. exercise.name
end,
}, function(selected_exercise, _)
if not selected_exercise then
Expand Down

0 comments on commit 1736e8e

Please sign in to comment.