Do we have a LSP that's able to read type annotations?

Guys, I’m fairly new to elixir and I wondering if there’s any LSP that has type inference. I’m trying to define modules that implement a behavior and would like to know if there’s a way to autocomplete when I receive a generic module from a functions parameter

let me give you an example:



defmodule Project.Crawler.Strategy do
  @callback get_page(%Project.Site{}, String.t()) :: page()
end

@spec crawl(Project.Crawler.Strategy) :: boolean()
def crawl(module) do
  module.
end

When I type module. on the crawl/1 I would like to have the intellisense about what options are available for module

Is there anything like that?

This cannot be supported by LSPs. Typespecs cannot notate “a module, which implements a behaviour”. They can only notate module(), which is any module and just an alias for atom(). You used a literal module name in your example. That also has nothing to do with behaviours. It’s just the name as is, like you could use e.g. :ok in a typespec as well.

The upcoming elixir typesystem might eventually provide a notation for that, but by now that typesystem has no code notation at all.