elixir_sense icon indicating copy to clipboard operation
elixir_sense copied to clipboard

Hover document still show documentation when assign value to variable that is the same name in built-in function

Open wingyplus opened this issue 4 years ago • 0 comments

Environment

  • Elixir & Erlang versions (elixir --version): 1.12.1
  • Operating system: Windows 10 64-bit
  • Editor or IDE name (e.g. Emacs/VSCode): VSCode
  • Editor Plugin/LSP Client name:

Description

Consider the example code below:

defmodule Vector do
  @spec magnitude(Vec2.t()) :: number()
  def magnitude(%Vec2{} = v), do: :math.sqrt(:math.pow(v.x, 2) + :math.pow(v.y, 2))

  @spec normalize(Vec2.t()) :: Vec2.t()
  def normalize(%Vec2{} = v) do
    length = magnitude(v)
    %{v | x: v.x / length, y: v.y / length}
  end
end

When I hover mouse on length in function normalize, the hover document will show length built-in document. But since magnitude function has type spec. I expected the hover should show it as a number or not show when hover on length variable.

wingyplus avatar Jun 13 '21 15:06 wingyplus