Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Currently, the plugin supports the following languages:
- Go
- Odin
- Haskell
- Elixir

More languages will be supported in future updates!

Expand Down Expand Up @@ -104,6 +105,7 @@ This will destroy the workspace and reinitialize it.
Code fsharp
Code odin
Code haskell
Code elixir
```

## Configuration
Expand Down
16 changes: 16 additions & 0 deletions lua/code-playground/commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ local java = require("code-playground.languages.java")
local zig = require("code-playground.languages.zig")
local typescript = require("code-playground.languages.typescript")
local fsharp = require("code-playground.languages.fsharp")
local elixir = require("code-playground.languages.elixir")
local options_manager = require("code-playground.options")
local animation = require("code-playground.animations")

Expand Down Expand Up @@ -305,4 +306,19 @@ M.zig = {
},
}

M.elixir = {
handle = function()
local def = elixir.run()
open_workspace(def.file, def.command)
end,
subcommands = {
reset = {
handle = function()
elixir.reset()
M.elixir.handle("", {})
end,
},
},
}

return M
26 changes: 26 additions & 0 deletions lua/code-playground/languages/elixir.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
local fileutils = require("code-playground.file-utils")
local root_path = vim.fs.joinpath(vim.fn.stdpath("data"), "code-playground")
local elixir_folder = vim.fs.joinpath(root_path, "elixir")
local main_exs = vim.fs.joinpath(elixir_folder, "main.exs")

local M = {}

local function ensure_files()
fileutils.ensure_directory_exists(elixir_folder)
fileutils.ensure_file_exists(main_exs, "elixir/main.exs")
end

---@return Run
M.run = function()
ensure_files()
return {
file = main_exs,
command = string.format("elixir %s", main_exs),
}
end

M.reset = function()
vim.fn.delete(elixir_folder, "rf")
end

return M
1 change: 1 addition & 0 deletions lua/code-playground/templates/elixir/main.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
IO.puts("Hello World!")