簡體   English   中英

在 VS Code 中將路徑設置為包含 Elixir 模塊的目錄

[英]To set the path to the directory containing the Elixir module in VS Code

我已經安裝了 ElixirLS 擴展。 我需要幫助從包含 Elixir 模塊的目錄打開 IEx session。 請幫助設置路徑

checkout.ex

defmodule Checkout do
  def total_cost(price, tax_rate) do
    price * (tax_rate + 1)
  end
end
MacBook-Pro:elixir-intro sudha$ elixirc checkout.ex
MacBook-Pro:elixir-intro sudha$ iex
Erlang/OTP 25 [erts-13.1.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit] [dtrace]

Interactive Elixir (1.14.1) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> Checkout.total_cost(100,0.2)

this is what I got -

** (UndefinedFunctionError) function Checkout.total_cost/2 is undefined (module Checkout is not available)
    Checkout.total_cost(100, 0.2)
    iex:1: (file)
iex(1)> 

您需要在iex session 中加載文件。請嘗試: iex -r checkout.ex或在iex內部嘗試c "checkout.ex"

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM