Bug 173342 - [Content Assist] Extra parameter hints due to search with prefix
Summary: [Content Assist] Extra parameter hints due to search with prefix
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-core (show other bugs)
Version: 4.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 4.0 M5   Edit
Assignee: Bryan Wilkinson CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2007-02-07 15:35 EST by Bryan Wilkinson CLA
Modified: 2009-01-09 15:09 EST (History)
0 users

See Also:


Attachments
proposed patch (75.84 KB, patch)
2007-02-07 15:46 EST, Bryan Wilkinson CLA
bjorn.freeman-benson: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Bryan Wilkinson CLA 2007-02-07 15:35:13 EST
Parameter hints are determined based on a prefix rather than a full name.

Example:

void foo(int i);
void fool(int i, int j);

void bar() {
  foo(//get parameter hints here

Expected:

Parameter hint popup "int i"

Actual:

Two possible parameter hints
"foo(int i) void" and "fool(int i,int j) void"

Both of these should only be valid for a code completion before the left parenthesis.
Comment 1 Bryan Wilkinson CLA 2007-02-07 15:46:11 EST
Created attachment 58482 [details]
proposed patch

- Changes to IASTName interface:
  - Removed resolvePrefix() - IBinding[]
  - Added getCompletionContext() - IASTCompletionContext
- Changes to IASTCompletionContext interface:
  - Removed resolvePrefix(IASTName n) - IBinding[]
  - Added findBindings(IASTName n, boolean isPrefix) - IBinding[]

All implementations of IASTCompletionContext have been changed to support finding bindings that start with given name as a prefix or bindings whose name matches the given name exactly.

The DOMCompletionProposalComputer decides how to find the bindings based on the content assist context.

This patch also contains a small test suite for parameter hints.
Comment 2 Anton Leherbauer CLA 2007-02-08 06:20:01 EST
Patch looks good! I adjusted two tests for a trivial difference (no more trailing spaces), but I'll do some more interactive testing...
Comment 3 Anton Leherbauer CLA 2007-02-08 09:05:43 EST
Committed to HEAD. Thanks, Bryan!