Align inline comments to a certain column
Align inline comments to a certain column
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
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
-
- Posts: 2245
- Joined: 25.08.2021 18:15
Re: Align inline comments to a certain column
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/
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/
-
- Posts: 2245
- Joined: 25.08.2021 18:15
Re: Align inline comments to a certain column
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.
- 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.
-
- Posts: 10
- Joined: 15.04.2015 15:37
Re: Align inline comments to a certain column
Thank you for the suggestions.
I'll try, although I'm not the great programmer.
I'll try, although I'm not the great programmer.
-
- Posts: 2245
- Joined: 25.08.2021 18:15
Re: Align inline comments to a certain column
i can write the plugin for you. if you write a good review about Cud on some site.
-
- Posts: 10
- Joined: 15.04.2015 15:37
Re: Align inline comments to a certain column
Review is a problem for me, i can make a donation. Let me say 50 EUR.
-
- Posts: 2245
- Joined: 25.08.2021 18:15
Re: Align inline comments to a certain column
donation is not needed, thanks.
-
- Posts: 2245
- Joined: 25.08.2021 18:15
Re: Align inline comments to a certain column
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.
https://github.com/Alexey-T/CudaText/issues
with the reward for ready plugin, 30$ is enough.
-
- Posts: 10
- Joined: 15.04.2015 15:37
Re: Align inline comments to a certain column
Hi Alexey, as i noticed donation is buying a license of "Universal Viewer". I just bought a license, (order number: 29674694)
-
- Posts: 2245
- Joined: 25.08.2021 18:15
Re: Align inline comments to a certain column
Thanks, I got the UVPro program buying, so I will help you.