Open eltoroit opened 5 years ago
Uncrustify has a -p [FILE]
option to dump debug info to a file. That's what it looks like with a standard hello world in C:
# Uncrustify-0.66.1_f
# option(s) with 'not default' value: 0
#
# -=====-
# Line Tag Parent Columns Br/Lvl/pp Flag Nl Text
# 1> PREPROC[ PP_INCLUDE][ 1/ 1/ 2/ 0][0/0/0][ 100080001][0-0] #
# 1> PP_INCLUDE[ NONE][ 2/ 2/ 9/ 0][0/0/0][ 1][0-0] include
# 1> STRING[ NONE][ 10/ 10/ 19/ 1][0/0/0][ 1][0-0] <stdio.h>
# 1> NEWLINE[ NONE][ 19/ 19/ 1/ 0][0/0/0][ 0][2-0]
# 3> TYPE[ FUNC_DEF][ 1/ 1/ 4/ 0][0/0/0][ 70000][0-0] int
# 3> FUNC_DEF[ NONE][ 5/ 5/ 9/ 1][0/0/0][ 0][0-0] main
# 3> FPAREN_OPEN[ FUNC_DEF][ 9/ 9/ 10/ 0][0/0/0][ 100000000][0-0] (
# 3> TYPE[ NONE][ 10/ 10/ 13/ 0][0/1/0][ 450008][0-0] int
# 3> WORD[ NONE][ 14/ 14/ 18/ 1][0/1/0][ 800008][0-0] argc
# 3> COMMA[ NONE][ 18/ 18/ 19/ 0][0/1/0][ 100000008][0-0] ,
# 3> TYPE[ NONE][ 20/ 20/ 24/ 1][0/1/0][ 440008][0-0] char
# 3> PTR_TYPE[ NONE][ 24/ 24/ 25/ 0][0/1/0][ 100000008][0-0] *
# 3> PTR_TYPE[ NONE][ 25/ 25/ 26/ 0][0/1/0][ 100000008][0-0] *
# 3> WORD[ NONE][ 27/ 27/ 31/ 1][0/1/0][ 800008][0-0] argv
# 3> FPAREN_CLOSE[ FUNC_DEF][ 31/ 31/ 32/ 0][0/0/0][ 100000000][0-0] )
# 3> BRACE_OPEN[ FUNC_DEF][ 33/ 33/ 34/ 1][0/0/0][ 100000000][0-0] {
# 3> NEWLINE[ NONE][ 34/ 34/ 1/ 0][1/1/0][ 0][1-0]
# 4> FUNC_CALL[ NONE][ 9/ 1/ 7/ 0][1/1/0][ 60000][0-0] printf
# 4> FPAREN_OPEN[ FUNC_CALL][ 15/ 7/ 8/ 0][1/1/0][ 100000000][0-0] (
# 4> STRING[ NONE][ 16/ 8/ 24/ 0][1/2/0][ 40010][0-0] "Hello, world !"
# 4> FPAREN_CLOSE[ FUNC_CALL][ 32/ 24/ 25/ 0][1/1/0][ 100000000][0-0] )
# 4> SEMICOLON[ NONE][ 33/ 25/ 26/ 0][1/1/0][ 100000000][0-0] ;
# 4> NEWLINE[ NONE][ 34/ 26/ 1/ 0][1/1/0][ 0][1-0]
# 5> RETURN[ NONE][ 9/ 1/ 7/ 0][1/1/0][ 60000][0-0] return
# 5> NUMBER[ NONE][ 16/ 8/ 9/ 1][1/1/0][ 40000][0-0] 0
# 5> SEMICOLON[ NONE][ 17/ 9/ 10/ 0][1/1/0][ 100000000][0-0] ;
# 5> NEWLINE[ NONE][ 18/ 10/ 1/ 0][1/1/0][ 0][1-0]
# 6> BRACE_CLOSE[ FUNC_DEF][ 1/ 1/ 2/ 0][0/0/0][ 100000000][0-0] }
# 6> NEWLINE[ NONE][ 2/ 2/ 1/ 0][0/0/0][ 0][1-0]
# -=====-
Maybe this can help you understand how uncrustify parses Apex code, and then know which setting is likely being applied? If this is the case, I can add this as an option in vscode-uncrustify.
I understand that Apex is not supported, but... there are few of us who are using it to format the Apex code in VS Code. We understand that we can use Java format, but there are some small differences that I am sure could be done with configuration settings... If we just knew which setting is being applied.
Is there a log or some other tool that lets me know which rules changed my code? That way I can set those rules to different values and have the format that I want?