Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 339931 - Code completion fails in #include statements
Summary: Code completion fails in #include statements
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-editor (show other bugs)
Version: 8.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 8.0   Edit
Assignee: Marc-André Laperle CLA
QA Contact: Anton Leherbauer CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-14 13:50 EDT by Dennis Schieferdecker CLA
Modified: 2011-03-16 17:24 EDT (History)
2 users (show)

See Also:


Attachments
InclusionProposalComputer project container patch (1.00 KB, patch)
2011-03-15 02:57 EDT, Marc-André Laperle CLA
malaperle: iplog-
Details | Diff
InclusionProposalComputer project container patch (1.46 KB, patch)
2011-03-16 03:23 EDT, Marc-André Laperle CLA
malaperle: iplog-
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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