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

Bug 339931

Summary: Code completion fails in #include statements
Product: [Tools] CDT Reporter: Dennis Schieferdecker <master_of_past_and_present>
Component: cdt-editorAssignee: Marc-André Laperle <malaperle>
Status: RESOLVED FIXED QA Contact: Anton Leherbauer <aleherb+eclipse>
Severity: normal    
Priority: P3 CC: cdtdoug, malaperle
Version: 8.0   
Target Milestone: 8.0   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
InclusionProposalComputer project container patch
malaperle: iplog-
InclusionProposalComputer project container patch malaperle: iplog-

Description Dennis Schieferdecker CLA 2011-03-14 13:50:58 EDT
Build Identifier: 20110218-0911

Code completion in #include statements fails if done in a subfolder and the entered folder hierarchy descends to the the project's base folder (note: not to the workspace's base folder, merely to the project's base folder).

Example:
- In "project_base/folder/test1.h" code completion fails when typing: #include "../<ctrl-space>
- In "project_base/folder/subfolder/test2.h" code completion works fine when typing: #include "../<ctrl-space>

Reproducible: Always

Steps to Reproduce:
1. Create a new C++ project
2. Add two folders A and B to the project
3. Create a header file in each folder, ex. a.h and b.h
4. Write  #include "../  in a.h and invoke code completion (ctrl-space); this will now fail to list the possible folders A and B
Comment 1 Marc-André Laperle CLA 2011-03-15 02:57:07 EDT
Created attachment 191192 [details]
InclusionProposalComputer project container patch

container.getFolder(IPath) doesn't work for segments == 1, it needs to get a IProject instead.
Comment 2 Marc-André Laperle CLA 2011-03-15 13:02:32 EDT
Comment on attachment 191192 [details]
InclusionProposalComputer project container patch

This patch isn't quite right because you can type ../otherproject/ and get the wrong proposals.
Comment 3 Marc-André Laperle CLA 2011-03-16 03:23:28 EDT
Created attachment 191279 [details]
InclusionProposalComputer project container patch

New patch that fixes the wrong project issue.
Comment 4 Marc-André Laperle CLA 2011-03-16 13:10:19 EDT
Fixed in HEAD.
Comment 5 CDT Genie CLA 2011-03-16 17:24:13 EDT
*** cdt cvs genie on behalf of mlaperle ***
Bug 339931 - Code completion fails in #include statements

[*] InclusionProposalComputer.java 1.7 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/InclusionProposalComputer.java?root=Tools_Project&r1=1.6&r2=1.7