Author Topic: Completion is scope sensitive ??  (Read 11998 times)

Offline daniloz

  • Regular
  • ***
  • Posts: 268
Completion is scope sensitive ??
« on: August 12, 2009, 09:44:16 am »
Hi All,

I'm new to this forum, but have been working with Code::Blocks for some while now and since I discovery it I really liked it. It's the best source code editor ever !! Thank you for the great job!

My questions now (sorry if this is well know, but I couldn't find it in the help or FAQs):

1- Is code completion working only in the part of the code that a variable is defined, for example? Is it that smart?

2- It doesn't seem to be working for me in the following example:

Code
int AAA;
 
void main()
{
int BBB;
int CCC;
}

That's what's happening:

-> If the cursor is inside the main() function, BBB and CCC get completed, BUT AAA is not found (no completions at all).

-> If the cursor is outside the main() function, none of the variables are completed.

BTW, I have the latest SVN version (compiled here using MinGW).

Thank you,
daniloz
« Last Edit: August 12, 2009, 10:30:42 am by daniloz »

Offline blueshake

  • Regular
  • ***
  • Posts: 458
Re: Completion is scope sensitive ??
« Reply #1 on: August 12, 2009, 12:16:09 pm »
if you type the codes, you need to save the file,so the codecompletion can get the chance to parse the file.
in the function,the codecompletion will parse the codes in the function body.so it work.have a try.it will work. :D

actually the current codecompletion can not parse file in real time.
« Last Edit: August 12, 2009, 12:18:21 pm by blueshake »
Keep low and hear the sadness of little dog.
I fall in love with a girl,but I don't dare to tell her.What should I do?

Offline daniloz

  • Regular
  • ***
  • Posts: 268
Re: Completion is scope sensitive ??
« Reply #2 on: August 12, 2009, 12:35:06 pm »
Hi,

Thanks for you reply.

if you type the codes, you need to save the file,so the codecompletion can get the chance to parse the file.

[...]

actually the current codecompletion can not parse file in real time.

I am aware of that. I've saved the file. :)

in the function,the codecompletion will parse the codes in the function body.so it work.have a try.it will work. :D

You're right. If the cursor is INSIDE the function, I get BBB and CCC completed. It works perfect.

HOWEVER, if the cursor is OUTSIDE the function, no completion is done AT ALL.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: Completion is scope sensitive ??
« Reply #3 on: August 12, 2009, 12:48:51 pm »
Works fine here for me:
AAA, BBB and CCC are completed inside the function, AAA is completed outside the function.
C::B svn r5730.

Which version do you use ?

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9693
Re: Completion is scope sensitive ??
« Reply #4 on: August 12, 2009, 12:55:15 pm »
Works fine here for me:
Works here, too.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline blueshake

  • Regular
  • ***
  • Posts: 458
Re: Completion is scope sensitive ??
« Reply #5 on: August 12, 2009, 12:56:27 pm »
Quote
HOWEVER, if the cursor is OUTSIDE the function, no completion is done AT ALL.
dose it still not work outside the function after you save the file?
the AAA showed in my local copy.
Keep low and hear the sadness of little dog.
I fall in love with a girl,but I don't dare to tell her.What should I do?

Offline daniloz

  • Regular
  • ***
  • Posts: 268
Re: Completion is scope sensitive ??
« Reply #6 on: August 12, 2009, 02:24:54 pm »
Ok, I have C::B svn r5730 as well and it's NOT working outside the function.  :shock:

Can it be related to my workspace? Any setting?

Actually, I have a 8.02 version of C::B installed (properly on C:\Program Files and everything) and it seems that the r5730 is aware of the settings I had with the v8.02. Is this possible?

Offline daniloz

  • Regular
  • ***
  • Posts: 268
Re: Completion is scope sensitive ??
« Reply #7 on: August 12, 2009, 03:01:05 pm »
Additional information:

I removed the configuration folder from the v8.02 installation and ran again the r5730 with default configuration.

No completion outside the function whatsoever.

Thanks!

Offline blueshake

  • Regular
  • ***
  • Posts: 458
Re: Completion is scope sensitive ??
« Reply #8 on: August 12, 2009, 03:10:04 pm »
it is strange.It work fine for me.
does codeblock 8.02 can work?as I konw .sometimes codeblock 8.02 may  not work when you type in
a new file.

I think you can try this.in svn 5730
 create a new console project which contains the basic codes. and try again.remember save the
file . :D
Keep low and hear the sadness of little dog.
I fall in love with a girl,but I don't dare to tell her.What should I do?

Offline daniloz

  • Regular
  • ***
  • Posts: 268
Re: Completion is scope sensitive ??
« Reply #9 on: August 12, 2009, 04:14:38 pm »
Thanks for the hint blueshake.

I did it and it's working now. But only if it's included in a project. What's the explanation? :D
 

Offline blueshake

  • Regular
  • ***
  • Posts: 458
Re: Completion is scope sensitive ??
« Reply #10 on: August 13, 2009, 03:11:09 am »
Quote
I did it and it's working now. But only if it's included in a project. What's the explanation?
sorry , it's out of my ability.
Keep low and hear the sadness of little dog.
I fall in love with a girl,but I don't dare to tell her.What should I do?