Page 1 of 2

Align inline comments to a certain column

Posted: 14.10.2023 16:05
by Snywrtne
Hi,
i often use inline comments at the end of the code line (i.e. at column 80, or a column mark made with the Plugin "Column Mark").
I'm looking for a way to align the comments in an easy manner to such a fixed column as is showed in that link:
https://stackoverflow.com/questions/581 ... -in-vscode
Can anybody give me a tip to achieve that.
Thanks in advance, Josef

Re: Align inline comments to a certain column

Posted: 14.10.2023 20:36
by main Alexey
to change any content, you must use plugin CudaFormatter with proper formatter-subplugin.

8 CudaFormatter
8.1 CudaFormatter commands
8.2 How to run formatter ESLint on saving
8.3 How formatter can know filename
https://wiki.freepascal.org/CudaText_plugins

so you need the 'formatter' whcih aligns comments to column e.g. 80.
not hard to make it.
this formatter can be written fast, e.g. for C / C++:

- take a line
- parse it to find inline comment (skip // chars inside strings, and skip multi-line comments)
- align comment

examples of formatters:
https://sourceforge.net/projects/cudate ... ormatters/

Re: Align inline comments to a certain column

Posted: 14.10.2023 20:44
by main Alexey
to parse a line to find comments, trick may be used.

- find '//' in line (it can be inside string too)
- check that '//' forms the real inline comment using Cud's API https://wiki.freepascal.org/CudaText_AP ... .get_token

'formatters' don't use this API, so it may be a simple plugin instead of 'formatter'. plugin which changes the current document.

Re: Align inline comments to a certain column

Posted: 18.10.2023 06:12
by Layerprogg
Thank you for the suggestions.
I'll try, although I'm not the great programmer.

Re: Align inline comments to a certain column

Posted: 19.10.2023 08:11
by main Alexey
i can write the plugin for you. if you write a good review about Cud on some site.

Re: Align inline comments to a certain column

Posted: 24.10.2023 12:51
by Layerprogg
Review is a problem for me, i can make a donation. Let me say 50 EUR.

Re: Align inline comments to a certain column

Posted: 24.10.2023 13:30
by main Alexey
donation is not needed, thanks.

Re: Align inline comments to a certain column

Posted: 24.10.2023 13:36
by main Alexey
what you can do: write the 'request for plugin' here
https://github.com/Alexey-T/CudaText/issues
with the reward for ready plugin, 30$ is enough.

Re: Align inline comments to a certain column

Posted: 03.11.2023 14:41
by Layerprogg
Hi Alexey, as i noticed donation is buying a license of "Universal Viewer". I just bought a license, (order number: 29674694)

Re: Align inline comments to a certain column

Posted: 03.11.2023 16:08
by main Alexey
Thanks, I got the UVPro program buying, so I will help you.