Author Topic: C function open brace...  (Read 4126 times)

joecar

  • Senior Community Member
  • Posts: 424
  • Hero Points: 9
  • engineer/gearhead
C function open brace...
« on: August 24, 2016, 10:35:20 PM »
I configured Application Language -> C/C++ --> Formatting to put a function block's open brace on the next line...

whenever SE beautifies, it pulls the function open brace to the same line as the function name...

what am I doing wrong...?

Thanks.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6864
  • Hero Points: 528
Re: C function open brace...
« Reply #1 on: August 25, 2016, 02:13:02 AM »
Hmm...works for me. I modified the default profile and it worked (Brace Style>Declaration Style>function/method blocks).

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1818
  • Hero Points: 151
Re: C function open brace...
« Reply #2 on: August 25, 2016, 01:47:28 PM »
Is it for all functions, or just a particular function that it's doing the wrong thing on?  If you copy the problem function out to a blank C++ file, does it still do it wrong then?

joecar

  • Senior Community Member
  • Posts: 424
  • Hero Points: 9
  • engineer/gearhead
Re: C function open brace...
« Reply #3 on: August 25, 2016, 08:54:43 PM »
I have Brace Style>Declaration Style>function/method blocks set to Next Line.

It happens for all functions, and it even happens when I copy any one of them to a blank C file.

And since smart paste is enabled, it also happens whenever I touch a line close to the function header.

« Last Edit: August 26, 2016, 07:13:43 PM by joecar »

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1818
  • Hero Points: 151
Re: C function open brace...
« Reply #4 on: August 26, 2016, 02:07:32 PM »
This is a strange one.  Your settings look right, code snippet looks fine.  I'd almost suspect something like the wrong beautifier profile being applied, though I haven't seen anything like that before. 

I'll need to look at your configuration, so we'll send you instructions on how to pack that up in a few minutes.  And save that snippet to a file and send it as well.  I doubt there's anything special in a small code snippet like that that I'm not seeing from the screen shot, but when in doubt, I lean towards paranoia.

SlickEdit Support

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 384
  • Hero Points: 29
Re: C function open brace...
« Reply #5 on: August 26, 2016, 02:11:43 PM »
Hi joecar,

We just pm'd you some upload instructions.

SlickEdit Support

joecar

  • Senior Community Member
  • Posts: 424
  • Hero Points: 9
  • engineer/gearhead
Re: C function open brace...
« Reply #6 on: August 26, 2016, 06:51:12 PM »
I uploaded what you requested.

Thanks.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6864
  • Hero Points: 528
Re: C function open brace...
« Reply #7 on: August 29, 2016, 02:25:44 PM »
So far, we are unable to reproduce the problem with your configuration.

if you create a new C++ source file and type "m<space-bar>" to get a main function template, are the braces in the right place for you?

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1818
  • Hero Points: 151
Re: C function open brace...
« Reply #8 on: August 29, 2016, 02:42:06 PM »
Also, turn off adaptive formatting, and see if the brace ends up in the correct place then - the beautifier does sync the brace style from adaptive formatting when it is enabled.  Adaptive formatting picks a brace style looking at all of the brace usage, and does not break usage down into different statement types, so it can homogenize your brace style in places that it differs from the most common use.

joecar

  • Senior Community Member
  • Posts: 424
  • Hero Points: 9
  • engineer/gearhead
Re: C function open brace...
« Reply #9 on: August 29, 2016, 11:35:18 PM »
So far, we are unable to reproduce the problem with your configuration.

if you create a new C++ source file and type "m<space-bar>" to get a main function template, are the braces in the right place for you?
Yes, the main() template puts the braces in the right place.


Also, turn off adaptive formatting, and see if the brace ends up in the correct place then - the beautifier does sync the brace style from adaptive formatting when it is enabled.  Adaptive formatting picks a brace style looking at all of the brace usage, and does not break usage down into different statement types, so it can homogenize your brace style in places that it differs from the most common use.
This seems to fix it.

Thanks.
« Last Edit: August 29, 2016, 11:37:30 PM by joecar »