SlickEdit Community

Archived Read Only Forums => SlickEdit 2016 v21 Beta Discussion => Topic started by: TKasparek on September 08, 2016, 07:05:07 pm

Title: extra NL added when auto-complete triggered in conditional statement
Post by: TKasparek on September 08, 2016, 07:05:07 pm
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.
Title: Re: extra NL added when auto-complete triggered in conditional statement
Post by: patrick 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?



Title: Re: extra NL added when auto-complete triggered in conditional statement
Post by: TKasparek 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.
Title: Re: extra NL added when auto-complete triggered in conditional statement
Post by: patrick 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. 
Title: Re: extra NL added when auto-complete triggered in conditional statement
Post by: patrick 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.