From 5afd37595edda5f64d32fad3a674cd106e8e02ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kan=20Nilsson?= Date: Fri, 27 Sep 2024 15:07:19 +0200 Subject: [PATCH] Handle parsing sigil (#1551) --- apps/els_lsp/src/els_erlfmt_ast.erl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/els_lsp/src/els_erlfmt_ast.erl b/apps/els_lsp/src/els_erlfmt_ast.erl index bbff5e112..925e8ef4c 100644 --- a/apps/els_lsp/src/els_erlfmt_ast.erl +++ b/apps/els_lsp/src/els_erlfmt_ast.erl @@ -680,6 +680,11 @@ erlfmt_to_st(Node) -> {args, Pos, Args} -> AAnno = dummy_anno(), erlfmt_to_st_1({tuple, Pos, [{atom, AAnno, '*args*'} | Args]}); + {sigil, Pos, _SigilPrefix, {string, StringPos0, Text}, _SigilSuffix} -> + %% erl_syntax doesn't handle sigils, so we just extract the string + %% Move start of string to start of sigil + StringPos = StringPos0#{location := maps:get(location, Pos)}, + erlfmt_to_st_1({string, StringPos, Text}); %% TODO: %% New `{spec_clause, Anno, Head, Body, Guards}` node for clauses %% inside `spec` and `callback` attributes, similar to the `clause`