ast icon indicating copy to clipboard operation
ast copied to clipboard

End-of-line comments not available in summary

Open henrikbarium opened this issue 2 years ago • 2 comments

If I run:

KotlinGrammarAntlrKotlinParser.parseKotlinFile(AstSource.String("source", "//line comment"))

The resulting raw AST contains the line comment (as expected). If I call summary() on that AST, the line comment is represented as a KlassComment (again, as expected).

Then, if I run:

KotlinGrammarAntlrKotlinParser.parseKotlinFile(AstSource.String("source", "val answer = 42 //line comment"))

Again, the resulting raw AST contains the line comment (as expected). However, if I call summary() on that AST I cannot find the comment anywhere.

Am I missing something or is this a limitation/bug in the library?

henrikbarium avatar Feb 27 '22 20:02 henrikbarium

Hi @henrikbarium, thank you for reporting, I will fix it.

drieks avatar Mar 03 '22 07:03 drieks

Hi @henrikbarium, should be working now. Some AST-Nodes were dropping "unrelated" AST-Nodes, but comments were handled as unrelated. I changed this "related" filter and added a new comment filter to keep all comment nodes.

Please try version 7a60784a13.

drieks avatar Mar 04 '22 23:03 drieks