Align inline comments to a certain column
-
- Posts: 2245
- Joined: 25.08.2021 18:15
Re: Align inline comments to a certain column
I will try to code this in the nearest N (<9) days.
-
- Posts: 2245
- Joined: 25.08.2021 18:15
Re: Align inline comments to a certain column
I made first version of the command.
Plugin CudaExt - my fork. command is here: "Plugins / CudaExt / Align / Align line-comments to a certain column".
To try it:
- remove CudaExt plugin if it's installed
- get my fork: "Plugins / Addons Manager / Install from Git", enter URL https://github.com/CudaText-addons/cuda_ext
- restart Cud
Please test.
Plugin CudaExt - my fork. command is here: "Plugins / CudaExt / Align / Align line-comments to a certain column".
To try it:
- remove CudaExt plugin if it's installed
- get my fork: "Plugins / Addons Manager / Install from Git", enter URL https://github.com/CudaText-addons/cuda_ext
- restart Cud
Please test.
-
- Posts: 10
- Joined: 15.04.2015 15:37
Re: Align inline comments to a certain column
Hi Alexey, works!
But there should be a treshold value for the algorithm.
All existing comments left of that threshold value should be ignored.
Example:
I often use a little comment at the end of a switch command to better identify the ending parenthesis.
I don't want this comment to be aligned with the pluging at i.e. column 80.
switch(cond) {
case 'ch':
break;
case nr:
break;
default: break;
} // switch
But there should be a treshold value for the algorithm.
All existing comments left of that threshold value should be ignored.
Example:
I often use a little comment at the end of a switch command to better identify the ending parenthesis.
I don't want this comment to be aligned with the pluging at i.e. column 80.
switch(cond) {
case 'ch':
break;
case nr:
break;
default: break;
} // switch
-
- Posts: 2245
- Joined: 25.08.2021 18:15
Re: Align inline comments to a certain column
hmm, how plugin can detect "this comment is not to change"? e.g. "} // switch" line - what is special for this line for plugin? how to detect all such lines "to not touch"?
-
- Posts: 10
- Joined: 15.04.2015 15:37
Re: Align inline comments to a certain column
Perhaps i didn't say it clear enough.
For me there are two numbers of interest:
1st: the column number to which the comments should be aligned.
2nd: a column number that says: ignore this line if a comment starts to the left of this column.
For my example this means: Align all comments to column 80 but ignore the line if there is a comment beginning left of i.e. column 40
best regards
For me there are two numbers of interest:
1st: the column number to which the comments should be aligned.
2nd: a column number that says: ignore this line if a comment starts to the left of this column.
For my example this means: Align all comments to column 80 but ignore the line if there is a comment beginning left of i.e. column 40
best regards
-
- Posts: 2245
- Joined: 25.08.2021 18:15
Re: Align inline comments to a certain column
okay. I updated the Git repo on github. changed to the prompt to ask for 2 options, 2nd option is "minimal allowed column of comment".
-
- Posts: 10
- Joined: 15.04.2015 15:37
Re: Align inline comments to a certain column
Hurray, that's it. Thank you very much
-
- Posts: 2245
- Joined: 25.08.2021 18:15
Re: Align inline comments to a certain column
todo for this command: support e.g. PHP lexer (currently PHP lexer blocks the code to work).