VS Code + ElixirLS intellisense with nested structs

VS Code 1.60.1, ElixirLS 0.8.1, Erlang 24.0.5, Elixir 12.0.3.
Kubuntu 21.04. with VS Code with remote development in Kubuntu 20.04.

Should intellisense work on nested structs? Eg. user defined struct with other struct fields, for example DateTime or another user defined struct. In code snippet below “dot” does not work for created DateTime-struct fields. In terminal iex-session autocomplete and tabbing works.

There are no errors in ElixirLS output window. I have tried removing .elixir_ls folder and different versions of VS Code and ElixirLS 0.8.0. I compiled ElixirLS with Erlang 24 and Elixir 12 but no difference.

defmodule P do
 defstruct [:name, :created]

 @type t :: %__MODULE__{
         name: String.t(),
         created: DateTime.t()
 }

 @spec new(name :: String.t()) :: t()
 def new(name)
   when is_binary(name) do
     %__MODULE__{name: name, created: DateTime.utc_now()}
 end

 def get_info(%P{} = p) do
   p.created
 end
end

I installed SublimeText 4, and following plug-ins: LSP, LSP-elixir and ElixirSyntax. Now I can “dot” into nested structs as expected. Perhaps there is some problem with VS Code and ElixirLS. (I installed the SublimeText directly to VM, because I am not sure how to get remote development over SSH working).

Can anyone confirm that VS Code and ElixirLS is working as expected or not regarding to this?

1 Like

The issue might get more visibility if posted as an issue on their Github project page.

1 Like