Author Topic: extra NL added when auto-complete triggered in conditional statement  (Read 1061 times)

TKasparek

  • Senior Community Member
  • Posts: 221
  • Hero Points: 27
In the following:
Code: [Select]
class my_class {
public:
    void expansionTrial1();
    void expansionTrial2();
};

void main() {

    class my_class a;

    for (int i; a.expansio; ++i) {

       // Place cursor after "a.expansio" above and hit CTL-Space, press down to select expansionTrial1 and press ENTER. Extra NL is placed above this line.
    }
}


I tried this example on vanilla install and was not able to reproduce and I haven't pinned down the option that triggers it but it seems wrong to add the extra NL between the brackets when the auto-complete isn't the conditional item itself but an autocomplete within the conditional.

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1169
  • Hero Points: 111
Re: extra NL added when auto-complete triggered in conditional statement
« Reply #1 on: September 08, 2016, 07:18:02 pm »
It's possible that the beautification of completions is doing that - when it beautifies a snippet, it may expand the source range of the snippet a little bit to get enough of a statement to allow it to parse correctly.  In your beautifier profile, are any of the Blank Lines -> Statements -> for -> * settings enabled?  If you turn them off, does it stop doing that?




TKasparek

  • Senior Community Member
  • Posts: 221
  • Hero Points: 27
Re: extra NL added when auto-complete triggered in conditional statement
« Reply #2 on: September 08, 2016, 10:55:03 pm »
Yep, those are all on. And that is definitely it.
If I do the following using autocomplete:
Code: [Select]
    for (int i; a.expansionTrial1() || a.expansionTrial1() || a.expansionTrial1(); ++i) {
I'll get 3 new blank lines after the open brace.

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1169
  • Hero Points: 111
Re: extra NL added when auto-complete triggered in conditional statement
« Reply #3 on: September 09, 2016, 01:20:27 pm »
Ok, I'll take a look at it, it's probably just adding too much source to the snippet before beautifying the expansion. 

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1169
  • Hero Points: 111
Re: extra NL added when auto-complete triggered in conditional statement
« Reply #4 on: September 09, 2016, 06:10:42 pm »
Fixed for the next build.  Thanks for the report.  Usually I have the "blank line before X block" either disabled or set to 0, so it wasn't something I was going to see in everyday work.