Skip to content

Commit

Permalink
feat: add default language option
Browse files Browse the repository at this point in the history
  • Loading branch information
2KAbhishek committed Nov 21, 2024
1 parent d669c00 commit 165f434
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lua/exercism/commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ M.setup = function()
end

if config.add_default_keybindings then
add_keymap('<leader>goe', ':ExercismList ruby<CR>', 'Exercism says hi')
add_keymap('<leader>exl', ':ExercismList<CR>', 'Exercism List')
add_keymap('<leader>ext', ':ExercismTest<CR>', 'Exercism Test')
end
end
Expand Down
6 changes: 3 additions & 3 deletions lua/exercism/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ local M = {}
---@field exercism_workspace string
---@field add_default_keybindings boolean
local config = {
name = 'World!',
add_default_keybindings = true,
exercism_workspace = '~/exercism',
default_language = 'ruby',
add_default_keybindings = true,
icons = {
concept = '',
practice = '',
}
},
}

---@type exercism.config
Expand Down
6 changes: 4 additions & 2 deletions lua/exercism/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ local function handle_selection(exercise_name, language)
local exercise_dir = get_exercise_dir(exercise_name, language)

if not Path:new(exercise_dir):exists() then
local download_cmd =
string.format('exercism download --track=%s --exercise=%s', language, exercise_name)
local download_cmd = string.format('exercism download --track=%s --exercise=%s', language, exercise_name)

utils.show_notification(
'Setting up exercise: ' .. exercise_name .. ' in ' .. language,
Expand All @@ -54,6 +53,9 @@ end

---@param language string
M.list_exercises = function(language)
if language == '' or language == nil then
language = config.default_language
end
local exercise_data = get_exercise_data(language)

if #exercise_data > 0 then
Expand Down

0 comments on commit 165f434

Please sign in to comment.