From 1e547b7f1e431bb42c80073ea9098f5973474b5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A0=91=E5=BD=B1?= <15079462244@163.com> Date: Mon, 9 Dec 2024 16:49:36 +0800 Subject: [PATCH] Supports parsing macro expansion as a function branch --- apps/els_lsp/src/els_parser.erl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/els_lsp/src/els_parser.erl b/apps/els_lsp/src/els_parser.erl index 943f06e7..a4aae170 100644 --- a/apps/els_lsp/src/els_parser.erl +++ b/apps/els_lsp/src/els_parser.erl @@ -797,7 +797,13 @@ analyze_function(FunName, Clauses0) -> -spec function_args(tree()) -> {arity(), els_arg:args()}. function_args(Clause) -> - Patterns = erl_syntax:clause_patterns(Clause), + Patterns = + case Clause of + {_, macro, _, _} -> + erl_syntax:macro_arguments(Clause); + _ -> + erl_syntax:clause_patterns(Clause) + end, Arity = length(Patterns), Args = args_from_subtrees(Patterns), {Arity, Args}.