Author Topic: Auto-completion issue  (Read 3822 times)

Online Commaster

  • Multiple posting newcomer
  • *
  • Posts: 87
Auto-completion issue
« 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.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12897
    • Travis build status
Re: Auto-completion issue
« Reply #1 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)?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Online Commaster

  • Multiple posting newcomer
  • *
  • Posts: 87
Re: Auto-completion issue
« Reply #2 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: [Select]
Auto-complete keyword: forb
Auto-complete match for keyword found.

P.P.S. Reverting all "false" to "true" fixed this issue.
« Last Edit: February 24, 2016, 02:13:54 pm by Commaster »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12897
    • Travis build status
Re: Auto-completion issue
« Reply #3 on: February 24, 2016, 08:10:05 pm »
@Commaster: Thanks for the bisect.

@Morten and bluehazzard: What do you think about this?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9604
Re: Auto-completion issue
« Reply #4 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.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9604
Re: Auto-completion issue
« Reply #5 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".
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Online Commaster

  • Multiple posting newcomer
  • *
  • Posts: 87
Re: Auto-completion issue
« Reply #6 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: [Select]
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: [Select]
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: [Select]
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?
« Last Edit: March 01, 2016, 12:38:25 pm by Commaster »

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2848
Re: Auto-completion issue
« Reply #7 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: [Select]
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: [Select]
forb


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

clearly not what you want, so more logic is needed
greetings

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2848
Re: Auto-completion issue
« Reply #8 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...

Offline blooden

  • Single posting newcomer
  • *
  • Posts: 2
Re: Auto-completion issue
« Reply #9 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.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5265
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Auto-completion issue
« Reply #10 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.
« Last Edit: November 16, 2020, 11:26:16 am by ollydbg »
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.