Code navigation and autocomplete in tests

I created some helper modules in test folder. When I used them in other test modules, autocomplete and code navigation (Ctrl + Click) didn’t work when I tried to used the helpers.

Is there anyway to enable autocomplete for helper modules defined in test folder?

I am using VS Code + Elixir language server

Modify this line in your mix.exs file:

  # Specifies which paths to compile per environment.
  defp elixirc_paths(:test), do: ["lib", "test/support"]
  defp elixirc_paths(_), do: ["lib"]

VSCode LS is running in dev mode, not test, so it won’t compile the files in support unless you change this to something like:

  defp elixirc_paths(:test), do: ["lib", "test/support"]
  defp elixirc_paths(:dev), do: ["lib", "test/support"]
  defp elixirc_paths(_), do: ["lib"]
1 Like

It should default to :test, but it’s configurable.

oh my bad, I just assumed. Need to check my setup then…