Menu

#178 Improve Comment Expert

None
closed-fixed
None
5
2026-03-22
2023-11-09
No

Commenting a selected block: If the selected block already contains the user-configured comment style character (e.g., { or }), the selected block in this case should automatically be commented with another comment style character not contained in the selected block instead!

This would helpfully allow commenting a selected block that already contains the user-configured comment style character.

Discussion

  • Thomas Mueller

    Thomas Mueller - 2023-11-15

    This is about the "Comment Code" and "Uncomment Code" expert pair.
    It is possible to configure the kind of comment to be used, based on the file extension. But if e.g. in a pas file the expert is configured to use { } and such a comment already exists, the expert will add another pair of {} around this comment which doesn't work because the first } already ends the comment. There is no way to nest the same type of comment in Pascal.

    The expert could in that case switch to the default comment style which is //. This comment style works fine with Pascal and C (and possibly other languages). Alternatively it could allow configuring a secondary comment style (in this case (* and *) to be used if the primary comment style already exists in the selected block. But that only works once. If yet another comment should be added, the secondary comment will also fail. The only comment style that works multiple times in Pascal is //.

     

    Last edit: Thomas Mueller 2025-05-05
  • Thomas Mueller

    Thomas Mueller - 2026-03-22

    implemented in revision #5317

     

Log in to post a comment.

MongoDB Logo MongoDB