Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 347809

Summary: The content assist does not propose class members declared below cursor for header file
Product: [Tools] PTP Reporter: John Liu <jwsliu>
Component: RDTAssignee: Project Inbox <ptp-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: recoskie
Version: 4.0.7   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=103857
Whiteboard:
Attachments:
Description Flags
the fix patch
none
Ops wrong file was attached, this is the right one. none

Description John Liu CLA 2011-05-31 10:59:16 EDT
If a content assist is triggered from a header file, the class members declared below cursor in header file won't be able to resolved.
Comment 1 John Liu CLA 2011-05-31 11:12:35 EDT
The problem happens when the class, which the content assist tried to resolve, is defined in a header file rather than in a source file. 

This is because when PDOMLinkage looks for the pdom file of a ITypedef binding, it only searches source file, so the class can't be resolved, therefore the content assist proposal won't be able to contain it.
Comment 2 John Liu CLA 2011-05-31 11:21:05 EDT
(In reply to comment #1)
> The problem happens when the class, which the content assist tried to resolve,
> is defined in a header file rather than in a source file. 
> This is because when PDOMLinkage looks for the pdom file of a ITypedef binding,
> it only searches source file, so the class can't be resolved, therefore the
> content assist proposal won't be able to contain it.

Also only the header file, in which content assist is triggered, can't be resolved properly. Other header files can be recolved from the project index.
Comment 3 John Liu CLA 2011-05-31 11:36:24 EDT
Created attachment 196991 [details]
the fix patch

The fix is in the function of getCompletionNode in TranslationUnit, in which we treat a header file as a source file, so its type definition can be resolved. 
This won't affect the project index and content assist result, as getCompletionNode runs in fly when the contenet assist is triggered and its parsed output is not saved in the index.
Comment 4 John Liu CLA 2011-05-31 11:44:33 EDT
Created attachment 196992 [details]
Ops wrong file was attached, this is the right one.
Comment 5 Chris Recoskie CLA 2011-06-01 15:23:09 EDT
Patch seems ok to me.
Comment 6 John Liu CLA 2011-06-01 16:18:09 EDT
Thanks Chris. The fix patch is committed into ptp_4_0 and HEAD.
Comment 7 John Liu CLA 2011-06-06 13:53:21 EDT
Fix in HEAD and ptp_4_0
Comment 8 John Liu CLA 2011-06-06 13:54:39 EDT
Fix in HEAD and ptp_4_0