Skip to content

Commit

Permalink
✨feat(swift): Added support for the swift cli.
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeioth committed Feb 4, 2024
1 parent a1d7d75 commit fbc3d8b
Showing 1 changed file with 52 additions and 1 deletion.
53 changes: 52 additions & 1 deletion lua/compiler/languages/swift.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ M.options = {
{ text = "Build and run program", value = "option1" },
{ text = "Build program", value = "option2" },
{ text = "Run program", value = "option3" },
{ text = "Build solution", value = "option4" }
{ text = "Build solution", value = "option4" },
{ text = "", value = "separator" },
{ text = "Swift build and run program", value = "option5" },
{ text = "Swift build program", value = "option6" },
{ text = "Swift run program", value = "option7" },
{ text = "", value = "separator" },
{ text = "Run REPL", value = "option8" }
}

--- Backend - overseer tasks performed on option selected
Expand Down Expand Up @@ -135,6 +141,51 @@ function M.action(selected_option)
task:start()
vim.cmd("OverseerOpen")
end
elseif selected_option == "option5" then
local task = overseer.new_task({
name = "- Swift compiler",
strategy = { "orchestrator",
tasks = {{ "shell", name = "- Swift build & run program → Package.swift",
cmd = "swift package clean" .. -- clean
" && swift build" .. -- compile
" && swift run" .. -- run
" && echo '" .. final_message .. "'"
},},},})
task:start()
vim.cmd("OverseerOpen")
elseif selected_option == "option6" then
local task = overseer.new_task({
name = "- Swift compiler",
strategy = { "orchestrator",
tasks = {{ "shell", name = "- Swift build program → Package.swift",
cmd = "swift package clean" .. -- clean
" && swift build" .. -- compile
" && echo '" .. final_message .. "'"
},},},})
task:start()
vim.cmd("OverseerOpen")
elseif selected_option == "option7" then
local task = overseer.new_task({
name = "- Swift compiler",
strategy = { "orchestrator",
tasks = {{ "shell", name = "- Swift run program → Package.swift",
cmd = "swift package clean" .. -- clean
" && swift run" .. -- run
" && echo '" .. final_message .. "'"
},},},})
task:start()
vim.cmd("OverseerOpen")
elseif selected_option == "option8" then
local task = overseer.new_task({
name = "- Swift compiler",
strategy = { "orchestrator",
tasks = {{ "shell", name = "- Start REPL",
cmd = output .. -- run
" && echo " .. output .. -- echo
" && echo '" .. final_message .. "'"
},},},})
task:start()
vim.cmd("OverseerOpen")
end
end

Expand Down

0 comments on commit fbc3d8b

Please sign in to comment.