Bug 175283 - [Content Assist] Invalid keyword completion
Summary: [Content Assist] Invalid keyword completion
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 M6   Edit
Assignee: Bryan Wilkinson CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2007-02-23 09:34 EST by Bryan Wilkinson CLA
Modified: 2009-01-09 15:09 EST (History)
1 user (show)

See Also:


Attachments
proposed patch (27.08 KB, patch)
2007-02-23 09:44 EST, Bryan Wilkinson CLA
no flags Details | Diff
revised patch (26.35 KB, patch)
2007-02-23 15:23 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-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".