Bug 175283

Summary: [Content Assist] Invalid keyword completion
Product: [Tools] CDT Reporter: Bryan Wilkinson <bryan2233>
Component: cdt-coreAssignee: Bryan Wilkinson <bryan2233>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: aleherb+eclipse
Version: 4.0Keywords: contributed
Target Milestone: 4.0 M6   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
proposed patch
none
revised patch bjorn.freeman-benson: iplog+

Description Bryan Wilkinson CLA 2007-02-23 09:34:47 EST
In the following code:

void foo() {
  b(//here

A completion at the indicated possition will result in:

void foo() {
  bbreak
Comment 1 Bryan Wilkinson CLA 2007-02-23 09:44:48 EST
Created attachment 59656 [details]
proposed patch

The KeywordCompletionContributor is hooked into the LegacyCompletionProposalComputer which moves the parse offset to the left of the left parenthesis, which is why "b" is used as a prefix rather than nothing at all.

This patch ports the KeywordCompletionContributor to the new completion proposal computer extension point so that it can use the invocation offset rather than the parse offset to find keyword completions.

This patch also ports the last of the legacy completion contributors, HelpCompletionContributor, to the new extension point.
Comment 2 Bryan Wilkinson CLA 2007-02-23 13:37:59 EST
Patch breaks preprocessor keyword completions.  I'll revise it when I find the time.
Comment 3 Bryan Wilkinson CLA 2007-02-23 15:23:18 EST
Created attachment 59707 [details]
revised patch

The pound symbol was not being included in the prefix for preprocessor completions.
Comment 4 Anton Leherbauer CLA 2007-02-26 03:06:40 EST
I am happy to look at it!
Comment 5 Anton Leherbauer CLA 2007-02-26 04:45:22 EST
Committed to HEAD. The keyword completion failure reminded me that the legacy completionContributors should not be invoked at all for context information. I added a check to the LegacyCompletionProposalComputer to avoid the same problem with other implementations.
As a follow-up, I would like to move the HelpCompletionProposalContributor into a new proposal computer category, e.g. "Documentation proposals".