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

Feature request: Hover for variables and attributes #164

Closed
wingyplus opened this issue Jun 13, 2021 · 3 comments
Closed

Feature request: Hover for variables and attributes #164

wingyplus opened this issue Jun 13, 2021 · 3 comments

Comments

@wingyplus
Copy link

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.

@lukaszsamson lukaszsamson transferred this issue from elixir-lsp/elixir-ls Oct 6, 2022
@lukaszsamson lukaszsamson changed the title Hover document still show documentation when assign value to variable that is the same name in built-in function Feature request: Hover for variables Mar 4, 2023
@lukaszsamson lukaszsamson changed the title Feature request: Hover for variables Feature request: Hover for variables and attributes Mar 7, 2023
@lukaszsamson
Copy link
Collaborator

Depends on #170

@lukaszsamson
Copy link
Collaborator

Partially addressed in #233

lukaszsamson added a commit that referenced this issue Jul 17, 2023
provide docs for variable when it shadows a function
provide docs for all module attributes
Partially addresses #164
@lukaszsamson
Copy link
Collaborator

Docs provider now handles variables, attributes and reserved words. I'm going to extract the part about type inference to a separate issue

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