Single line comments nicely avoid the nesting problem. I can write:
# # foo
without any issues, enabling me to comment out a region that contains a comment.
Multiline comments are much more awkward, as many languages don't support nesting:
/* /* foo */ */
Related Posts
Copilot doesn't offer a way of disabling completion inside comments. People have discovered a comical workaround: swearing in the comment! https://github.com/orgs/community/discussions/8062#discussioncomment-11902740
ASTs typically discard comments, and that's usually what you want.
The only time (AFAICS) that preserving comments is useful is for writing a code formatter.
Could you write a formatter in terms of a list of lexemes? A CST is a non-trivial bit of code for one use case.
I'm pretty impressed with Cursor: I've successfully asked it to perform codebase transforms in English, and it's worked!
E.g. "Replace all calls foo(..., true) with foo_immediate(...) define a foo_immediate function".
I'm still reading the diff and checking tests -- it's still AI after all.