Bugzilla will undergo maintenance 2024-03-29 18h00 CET. Bugzilla will be placed in read-only mode at that time.

Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 72809 - [Content Assist] CA is disabled by #ifdef conditional in users code
Summary: [Content Assist] CA is disabled by #ifdef conditional in users code
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-editor (show other bugs)
Version: 2.0   Edit
Hardware: PC Linux-GTK
: P3 enhancement with 6 votes (vote)
Target Milestone: 9.3.0   Edit
Assignee: Nathan Ridge CLA
QA Contact: Mike Kucera CLA
URL:
Whiteboard:
Keywords:
: 72826 98352 (view as bug list)
Depends on:
Blocks: 510478
  Show dependency tree
 
Reported: 2004-08-27 13:59 EDT by Bill Hilliard CLA
Modified: 2017-02-05 17:05 EST (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bill Hilliard CLA 2004-08-27 13:59:24 EDT
I just checked out the latest cdt_2_0 branch (should be close to or equal 
2.0.1 RC1) and discovered a problem with the content assist feature.

It seems that if I have section of code inside a conditional, content assist 
does not work if the conditional is not true in the property page setting.  
For example a simple helloworld managedbuild C project,

#include <stdio.h>

int
main ( int argc, char *argv[] )
{
   printf ( "Helloworld.\n" ) ;

#ifdef PRINT_ARGS
(*)
#endif

   return ( 0 ) ;
}

If I have not defined PRINT_ARGS in the property page (-DPRINT_ARGS), then I
cannot use content assist inside the conditional to say, enter a for loop
starting on the empty line (*) by typing "for" cntl-space.
Comment 1 John Camelon CLA 2004-08-27 14:14:01 EDT
That is the design intent. 
The next generation of source code parser should be able to figure out how to 
take both sides of #if branches.  

Marking this as an enhancement and setting to Future. 
Comment 2 Doug Schaefer CLA 2005-04-19 15:13:15 EDT
*** Bug 72826 has been marked as a duplicate of this bug. ***
Comment 3 Olivier Corbun CLA 2007-02-06 03:56:59 EST
I believe code completion should not care about if PRINT_ARGS is defined or not. If the user wants to code inside #ifdef / #endif, it is probably legitimate anyway. So CA should be available no matter what.
Comment 4 Markus Schorn CLA 2007-06-22 04:30:33 EDT
*** Bug 98352 has been marked as a duplicate of this bug. ***
Comment 5 André Goddard Rosa CLA 2008-09-06 08:43:12 EDT
Hi... Is there any progress on this issue? I think this is such a user visible improvement... You know, I love CDT, you guys rock.

I work on big projects who are shared between multiple teams. There are _lots_ of ifdefs and they are managed by makefiles, so it's kind of a burden to have to insert each one of them into eclipse build system...

And it makes the same information replicated in more than one place.

Is this such a complicated issue? If you need a hand, I can perhaps take a stab on it with you.

Thanks,
Andre
Comment 6 André Goddard Rosa CLA 2008-09-06 08:45:22 EDT
Another thing I miss too much is the ability to follow navigating inside functions protected by random ifdef (by ctlr+mouse click over function name).
Comment 7 Andrew Gvozdev CLA 2008-09-06 11:19:50 EDT
(In reply to comment #5)
> 
> I work on big projects who are shared between multiple teams. There are _lots_
> of ifdefs and they are managed by makefiles, so it's kind of a burden to have to
> insert each one of them into eclipse build system...

Did you try scanner discovery? It is supposed to figure out your -D for indexer from makefile output.
Comment 8 Doug Schaefer CLA 2009-12-04 12:23:42 EST
Returning old defects to pool so I can have an accurate list of what I'm working on.
Comment 9 Nathan Ridge CLA 2013-12-15 21:09:00 EST
I tested this with CDT master:

  - "for" + ctrl+space inside the ifdef offers the for loop completion
  - just ctrl+space inside the ifdef offers all available completions
  - a prefix, e.g. "prin" + ctrl+space inside the ifdef still offers
    all available completions, without filtering for the prefix

The last one is a bug. Let's leave this report open for that.
Comment 10 Nathan Ridge CLA 2017-01-12 02:07:51 EST
(In reply to Nathan Ridge from comment #9)
> I tested this with CDT master:
> 
>   - "for" + ctrl+space inside the ifdef offers the for loop completion
>   - just ctrl+space inside the ifdef offers all available completions
>   - a prefix, e.g. "prin" + ctrl+space inside the ifdef still offers
>     all available completions, without filtering for the prefix
> 
> The last one is a bug. Let's leave this report open for that.

Testing with current CDT master, the behaviour is even worse: even "for" + Ctrl+Space offers all available completions rather than the for loop completion.
Comment 11 Eclipse Genie CLA 2017-01-15 20:00:55 EST
New Gerrit change created: https://git.eclipse.org/r/88729
Comment 13 Nathan Ridge CLA 2017-01-22 20:22:48 EST
Fixed for 9.3.
Comment 14 Nathan Ridge CLA 2017-02-05 17:05:17 EST
Mentioned in the 9.3 N&N: https://wiki.eclipse.org/CDT/User/NewIn93#Improved_content_assist_in_inactive_code