File tree Expand file tree Collapse file tree 1 file changed +13
-10
lines changed Expand file tree Collapse file tree 1 file changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -256,23 +256,25 @@ def _parse_resources(
256256 None ,
257257 FluentJunkFound (
258258 "Junk found:\n "
259- + "\n " .join (
260- " {}: {}" .format (
261- display_location (
262- ftl_resource .filename ,
263- span_to_position (a .span , ftl_resource .text ),
264- ),
265- a .message ,
266- )
267- for a in item .annotations
268- ),
259+ + "\n " .join (_format_junk_annotation (ftl_resource , a ) for a in item .annotations ),
269260 item .annotations ,
270261 ),
271262 )
272263 )
273264 return output_dict , parsing_issues
274265
275266
267+ def _format_junk_annotation (ftl_resource : FtlResource , annotation : fl_ast .Annotation ) -> str :
268+ assert annotation .span is not None
269+ return " {}: {}" .format (
270+ display_location (
271+ ftl_resource .filename ,
272+ span_to_position (annotation .span , ftl_resource .text ),
273+ ),
274+ annotation .message ,
275+ )
276+
277+
276278TermOrMessage : TypeAlias = Union [fl_ast .Message , fl_ast .Term ]
277279
278280
@@ -1355,6 +1357,7 @@ def unknown_reference(
13551357
13561358def display_ast_location (ast_node : fl_ast .SyntaxNode , compiler_env : CompilerEnvironment ) -> str :
13571359 ftl_resource = compiler_env .current .ftl_resource
1360+ assert ast_node .span is not None
13581361 return display_location (ftl_resource .filename , span_to_position (ast_node .span , ftl_resource .text ))
13591362
13601363
You can’t perform that action at this time.
0 commit comments