kotlinx/ast

End-of-line comments not available in summary

henrikbarium opened this issue · 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?

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

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.