tal
Q: my first hour, how to run in vscode?
just d/l and installed elixir (win auto installer) and added the elixirls extension to vscode.
vscode recognizes my hello.ex file as elixir.
how do I compile/run my single line hello world via the ide?
Most Liked
Sebb
running “Hello, World!” is the hardest part in learning Elixir. Its a little crazy. But as soon as that is out of the way, I promise, It’ll be a fun ride.
If you created your project with mix new Hello there is a module Hello in lib.
In there is a comment that tells you to run:
iex> Hello.hello()
:world
what it doesn’t tell you is, that you have to start iex in this way
iex -S mix
You can also run the function directly
mix run -e Hello.hello
but you should add something that you can see on the console first, like
def hello do
IO.puts("hello")
end
Note: If there are processes involved (later!) you’ll need to add --no-halt but then you’ll but build a Supervision-Tree (later!!) anyway (and you run an OTP-application and not just one function).
In the beginning I’d just put everything in tests and run
mix test
To run the test with a vscode-hotkey look here:
NobbZ
VScode is not an IDE, it tries to, but at the end it is “just” a smart editor.
Don’t try to rely on IDE features, learn to do things from the terminal.
mix is easy to use.
To run a single file script, just do elixir script.ex, its not how things usually are done though.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









