Code::Blocks Forums

User forums => Help => Topic started by: Commaster on February 22, 2016, 01:20:31 pm

Title: Auto-completion issue
Post by: Commaster on February 22, 2016, 01:20:31 pm
Greetings.

I haven't used this feature (aka Ctrl+J) for the last 50+ revisions and this came to me as a surprise. Typing "forb" and pressing Ctrl+J or the menu item doesn't create a loop template.

Already tested with erasing my profile ~/.config/codeblocks and with a brand new console project from the wizard, still no result.

I haven't changed my Code::Blocks-compilation script since forever (still building against 2.8.12, since with wxtrunk I'm having some linker issues).
Any hints where I should look to make it work again?

Thanks,
Commaster.
Title: Re: Auto-completion issue
Post by: oBFusCATed on February 22, 2016, 09:25:01 pm
I can confirm this problem.
Do you know in which revision it worked?
Can you do a bisect (binary search)?
Title: Re: Auto-completion issue
Post by: Commaster on February 24, 2016, 12:42:50 pm
Done:
10700+ 10735- 10716- 10710+ 10711-

10711 is an abbreviations fix, which broke it completely (looks like it)

P.S. Double-checked 10710:
Code
Auto-complete keyword: forb
Auto-complete match for keyword found.

P.P.S. Reverting all "false" to "true" fixed this issue.
Title: Re: Auto-completion issue
Post by: oBFusCATed on February 24, 2016, 08:10:05 pm
@Commaster: Thanks for the bisect.

@Morten and bluehazzard: What do you think about this?
Title: Re: Auto-completion issue
Post by: MortenMacFly on February 26, 2016, 07:20:12 am
@Morten and bluehazzard: What do you think about this?
Reverted for the moment... I'll need to further investigate.
Title: Re: Auto-completion issue
Post by: MortenMacFly on February 26, 2016, 11:16:40 am
Reverted for the moment... I'll need to further investigate.
Well that is really weird. I was testing this patch and it was working the time back. Now I can't make it work again. The only thing I can imagine is that I was working either on the wrong copy of C::B or the test case was too simple or "special".
Title: Re: Auto-completion issue
Post by: Commaster on February 29, 2016, 09:05:32 pm
I thought I could jump in on this and investigate a bit.

So I put this snippet in the abbreviations.cpp...

Code
wxString foo;
foo << control->WordStartPosition(curPos, true);
foo << _T(" vs. ");
foo << control->WordStartPosition(curPos, false);
foo << _T(" and ");
foo << control->WordEndPosition(curPos, true);
foo << _T(" vs. ");
foo << control->WordEndPosition(curPos, false);
logMan->DebugLog(_T("Data on positions: ") + foo);

And the result is as follows...

Code
Data on positions: 7054 vs. 7054 and 7058 vs. 7060
Auto-complete keyword: forb
Auto-complete match for keyword found.

My suspicion would be that the "false" case eats up the EOL (most likely \r\n) and thus fails to find a match. (note that the word start position doesn't change ... in this case)

But I'm sure you already know this.

Update:
Confirmed that "false" eats up all EOLs (source had 2 EOLs following the input line):
Code
Data on positions: 5095 vs. 5095 and 5099 vs. 5103
false: forb


true: forb
Auto-complete keyword: forb
Auto-complete match for keyword found.
Maybe we can just trim EOLs and it "should" work?
Title: Re: Auto-completion issue
Post by: BlueHazzard on March 03, 2016, 05:55:43 pm
Reverted for the moment... I'll need to further investigate.
Well that is really weird. I was testing this patch and it was working the time back. Now I can't make it work again. The only thing I can imagine is that I was working either on the wrong copy of C::B or the test case was too simple or "special".
It works if there is no trailing whitespace or newline. I didn't tested this neither...


Update:
Confirmed that "false" eats up all EOLs (source had 2 EOLs following the input line):
Code
Data on positions: 5095 vs. 5095 and 5099 vs. 5103
false: forb


true: forb
Auto-complete keyword: forb
Auto-complete match for keyword found.
Maybe we can just trim EOLs and it "should" work?
Can confirm this. the problem with trim is, that it deletes also all newlines that are between the completion word and the next word, so if you have something like this
Code
forb


test
you end with this:
Code
for (; ; )
{
   
}test

clearly not what you want, so more logic is needed
greetings
Title: Re: Auto-completion issue
Post by: BlueHazzard on March 03, 2016, 06:45:19 pm
Does someone know what the original issue was? I can't find anything on sf tickets or here in the forum...
Title: Re: Auto-completion issue
Post by: blooden on November 13, 2020, 08:30:07 pm
Hello,
My autocomplete is not working. It complates char,switch or variable names, but it is not complate functions like scanf printf. What is the problem. I checked my editor setting to activate code completion but it is active. What can i do? Thanks.
Title: Re: Auto-completion issue
Post by: ollydbg on November 16, 2020, 01:54:34 am
Hello,
My autocomplete is not working. It complates char,switch or variable names, but it is not complate functions like scanf printf. What is the problem. I checked my editor setting to activate code completion but it is active. What can i do? Thanks.
Please don't reply on a three years old thread, just start a new thread.