Search code examples
visual-studio-codemakefileerlang

VS Code doesn't process Erlang Makefile


I'm working on an old erlang code that uses Makefiles to compile. The makefile defines some "include" paths:

# Erlang include directories. 
HRL_INCLUDE_DIRS = \
    ../include

My module imports modules from that path and uses it:

-include("logger.hrl").

VS Code doesn't seem to find this file (red squiggly line under the include statement and function calls.), because logger should have relative or absolute path.

The Makefile does the magic behind the scenes but VS Code doesn't read it.

How to configure VS Code to read the makefile?


Solution

  • The question is where the red squiggly line is coming from. Are you using the erlang-ls extension? If so, you probably need to configure include_dirs in an erlang_ls.config file in the root of your project.

    include_dirs:
      - "path/to/include"