Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No suggestions for @speced function params #1125

Open
2 tasks done
SergeyMosin opened this issue Oct 21, 2024 · 1 comment
Open
2 tasks done

No suggestions for @speced function params #1125

SergeyMosin opened this issue Oct 21, 2024 · 1 comment

Comments

@SergeyMosin
Copy link

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
image

Expected result

Autocomplete/suggestions should work for the person variable in hello1() the same way they work in the hello2() function
image

Relevant info

Strangely enough, suggestions work for the p1 variable in the hello3() function
image

@lukaszsamson
Copy link
Collaborator

Already tracked in elixir-lsp/elixir_sense#203

@lukaszsamson lukaszsamson transferred this issue from elixir-lsp/vscode-elixir-ls Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants