Skip to content

Macro references are not fully found across the project #175

@Perry-Sw

Description

@Perry-Sw

Environment

  • OS: Windows 10
  • Editor: VSCode
  • Erlang LS version: [0.0.39]
  • Erlang/OTP version: [OTP25]

Problem Description

I have a project with the following erlang_ls.config:

include_dirs:
  - "server/include"
  - "server/src"
  - "server/src/*"
  - "server/src/*/*"
  - "server/src/*/*/*"

I have a macro defined in server/include/adm.hrl:

-define(adm_free, ...).

This macro is used in multiple .erl files across different directories.
However, when I use "Find All References" or "Go to Definition" on ?adm_free, Erlang LS only finds some references, or sometimes only the current file, but not all usages across the project.

I have confirmed that:

  • All relevant directories are included in include_dirs.
  • The macro is used in files that are definitely within the indexed paths.
  • I have deleted the .erlang_ls directory and restarted the editor, but the problem persists.
  • Other symbols (functions, records) work fine for "Find All References".

Expected Behavior

"Find All References" and "Go to Definition" should find all usages and the definition of the macro across the entire project, not just in the current file or a subset of files.

Additional Information

  • There are no errors in the Erlang LS logs related to indexing or include paths.
  • Using ripgrep/grep, I can find all macro usages as expected.

Steps to Reproduce

  1. Define a macro in a header file included in multiple modules.
  2. Use the macro in several .erl files in different subdirectories.
  3. Use "Find All References" or "Go to Definition" on the macro.
  4. Observe that not all references are found.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions