StripComments is a Lazarus IDE package that adds a menu item for removing comments from the currently open unit in the editor. This package strips out line comments and block comments from an Object Pascal unit (both `{ }` and `(* *)` comment styles).
- Handles nested `{ { } }` blocks.
- GUIDs are safe.
- Compiler directives are safe.
- JSON strings are safe.
- Regular Expressions are safe.
- `{ }` inside string literals are safe.
Installation
1. Unzip
stripcomments.zip:
2. Navigate to the directory containing your package:
cd path/to/your/package3. Open a terminal and execute the following commands:
lazbuild strpcomments.lpk lazbuild --add-package strpcomments.lpk lazbuild --build-ide= --build-mode=Usage
After installation, the "Remove Comments" option will be available in the Lazarus IDE under the "Edit" menu by default, but you have the option to place it in the "Source" menu, the source editor popup menu, or all of them by uncommenting those options in the code.
The keyboard shortcut
Ctrl+Shift+R will also perform the "Remove Comments" menu item.
License
This project is licensed under the MIT License. See the LICENSE inside unit file for details.
Warranty
None. Code is available for you. Will try to fix installation errors, and may add additional fixes if they affect my own work.
Thanks to cdbc, JuhaManninen, DomingoGP and Roland57 for encouragement, tips, and pointing out fails!