Open
Description
Environment
Elixir & Erlang versions (elixir --version):
Erlang/OTP 26 [erts-14.2.5.4] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit:ns]
Elixir 1.17.3 (compiled with Erlang/OTP 26)
VSCode ElixirLS version: v0.24.2
Operating System Version: Ubuntu 22.04.5 LTS
Troubleshooting
- Restart your editor (which will restart ElixirLS) sometimes fixes issues
- Stop your editor, remove the entire
.elixir_ls
directory, then restart your editor
Details
Given this code:
defmodule MyMod do
@type t :: %MyMod{
id: pos_integer(),
name: binary()
}
defstruct id: 0,
name: ""
@spec hello1(person :: MyMod.t()) :: MyMod.t()
defp hello1(person) do
IO.inspect(person)
end
@spec hello2(person :: MyMod.t()) :: MyMod.t()
defp hello2(%MyMod{} = person) do
IO.inspect(person)
end
@spec hello3(person :: MyMod.t()) :: MyMod.t()
defp hello3(person) do
p1 = hello1(person)
IO.inspect(p1)
end
def say_hello() do
person = %MyMod{
id: 123,
name: "Bob"
}
hello1(person)
hello2(person)
hello3(person)
end
end
Problem
Autocomplete/suggestions for the person
variable do not work in the hello1()
function
Expected result
Autocomplete/suggestions should work for the person
variable in hello1()
the same way they work in the hello2()
function
Relevant info
Strangely enough, suggestions work for the p1
variable in the hello3()
function
Metadata
Metadata
Assignees
Labels
No labels