cheshirekow / cmake_format

Source code formatter for cmake listfiles.
GNU General Public License v3.0
954 stars 105 forks source link

"--separate-fn-name-with-space" does not work properly #212

Closed tawmoto closed 4 years ago

tawmoto commented 4 years ago

Hi,

I run this command

cmake-format --line-width=120 --separate-ctrl-name-with-space=true --separate-fn-name-with-space=false --tab-size=4 <file> -i

And I see that it adds a space between function name and the parantheses, which seems wrong, I just want space between control flow names.

image

Am I doing something wrong? Thanks

cheshirekow commented 4 years ago

Sounds like you are looking for https://cmake-format.readthedocs.io/en/latest/configopts.html#separate-ctrl-name-with-space

tawmoto commented 4 years ago

Sounds like you are looking for https://cmake-format.readthedocs.io/en/latest/configopts.html#separate-ctrl-name-with-space

I set this option as true. Shouldn't this apply for flow-control stuff like if/else? What I want: to have if/else with space, but functions without space.

Sorry, the documentation is great but sometimes they lack examples and is not clear exactly what an option does.

cheshirekow commented 4 years ago

test.cmake:

if(FOO AND BAR)
  dothing()
endif()

cmake-format --separate-ctrl-name-with-space=true /tmp/test.cmake:

if (FOO AND BAR)
  dothing()
endif ()

cmake-format --separate-ctrl-name-with-space=false /tmp/test.cmake

if(FOO AND BAR)
  dothing()
endif()

sometimes they lack examples and is not clear exactly what an option does.

Yeah, I would like to add examples as I think they would help illustrate the usage for these but I haven't had the time.

cheshirekow commented 4 years ago

Does this example illustrate what you're looking for? Any further questions?

tawmoto commented 4 years ago

Hi @cheshirekow , thanks for for the moment we will postpone cmake-format integration in our company project, we still have to analyze some corner cases. I hope I will get back to it soon.