Closed jeremyong-az closed 2 years ago
Wouldn't it be better to preserve the comments? That would give some landmarks to authors who can navigate their code by familiarity, or leave anchors to search for. Especially in case of wrong line reporting, because of potential miss in the line directives (not unheard-of). I don't remember why we chose to remove them, it's possible that the reason is as simple as they just get skipped by AntlR's lexer, and we never made the effort of recovering them.
@siliconvoodoo There are two reasons I can think of for stripping comments.
It may be useful to have an option to preserve them however.
fair!
btw I found the likely culprit for the empty lines, I suspect commit 396d653f
Also I'm noting bugs in line directive generation (that we should be relying on instead of empty lines btw). This might relate to bug https://github.com/o3de/o3de-azslc/issues/39
Ok I have a fix. (commit b3518ad1adacd87e4f4676992da00d8bac6f5796) Before:
In between (change to a line emission system rather than line feeds)
After improvement with "line economy" (only reemit when out of sync)
Example2:
Submitted in #61
For example ^.
The new lines here corresponded to stripped comments, but instead of emitting new lines, we should just be adjusting the first argument of those
#line
directives.