Bug 172723 - [Content Assist] Port DOMCompletionContributor to new extension point
Summary: [Content Assist] Port DOMCompletionContributor to new extension point
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-core (show other bugs)
Version: 4.0   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: 4.0 M5   Edit
Assignee: Bryan Wilkinson CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks: 172865
  Show dependency tree
 
Reported: 2007-02-02 16:52 EST by Bryan Wilkinson CLA
Modified: 2009-01-09 15:09 EST (History)
1 user (show)

See Also:


Attachments
proposed patch (90.14 KB, patch)
2007-02-02 17:09 EST, Bryan Wilkinson CLA
no flags Details | Diff
revised patch (99.13 KB, patch)
2007-02-05 12:02 EST, Bryan Wilkinson CLA
bjorn.freeman-benson: iplog+
Details | Diff
Different approach to filter duplicates (98.41 KB, patch)
2007-02-06 05:48 EST, Anton Leherbauer CLA
no flags Details | Diff
Different approach to filter duplicates (100.50 KB, patch)
2007-02-06 07:26 EST, Anton Leherbauer 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-02 16:52:50 EST
The DOMCompletionContributor is hooked into a legacy content assist processor.  Porting it to the new extension point will make it much more flexible, which I currently require to provide better support the display of parameter hints for functions and constructors.
Comment 1 Bryan Wilkinson CLA 2007-02-02 17:09:44 EST
Created attachment 58160 [details]
proposed patch

This patch consists of a new DOMCompletionProposalComputer which has all of the functionality of the old DOMCompletionContributor.  It inherits from a ParsingBasedProposalComputer abstract class, which handles the creation of the completion node.  CContentAssistInvocationContext has been augmented to include more context information.

CCompletionProcessor2 has been removed and the legacy completionContributors extension point is now being handled directly by LegacyCompletionProposalComputer, which also inherits from ParsingBasedProposalComputer.

In the process I also added support for showing parameter hints through code completion (i.e. not CTRL-SHFT-Space), when appropriate, as this was my reason for doing the port.

E.g.  foo(//here
      a.foo(//here
      new Foo(param, //here

Two of the completion tests are failing due to this new functionality, but I believe that the functionality invalidates the tests rather than the other way around :)
Comment 2 Anton Leherbauer CLA 2007-02-05 10:11:00 EST
The necessary changes in plugin.xml are missing, but apart from that I am happy with the patch. Just a minor issue:
- parameter hints through Ctrl+Shift+Space can contain duplicates now, because the proposal filter is not applied (the filtering and sorting is a problem on its own)

Providing parameter hints inside function argument lists is a good idea. Without prefix, the proposals tend to be useless in many cases anyway.
The tests you mentioned are probably obsolete, then. On the other hand, that reminds me that it would be good to have tests for paramter hints :)
Comment 3 Bryan Wilkinson CLA 2007-02-05 12:02:51 EST
Created attachment 58260 [details]
revised patch

Revised patch incudes:
- the missing plugin.xml changes
- a very temporary fix for the duplicate parameter hints via CTRL-SHFT-Space
  (see CContentAssistProcessor.filterAndSortContextInformation(...))
- the removal of the two obsolete tests

I will look into creating some parameter hint tests later this week.
Comment 4 Anton Leherbauer CLA 2007-02-06 05:48:59 EST
Created attachment 58327 [details]
Different approach to filter duplicates

I removed the temporary fix to filter duplicate parameter hints and implemented the filtering based on proposal equality in the ParsingBasedProposalComputer. This misses on possible duplicate parameter hints from other proposal computers, but I think its the proposal computer's responsibility to avoid duplicates. I had to adjust the equals and hashCode methods of CCompletionProposal, but I don't see a problem with that.
Please tell me if you are OK with it.
Comment 5 Anton Leherbauer CLA 2007-02-06 07:26:58 EST
Created attachment 58332 [details]
Different approach to filter duplicates

Forgot to add CCompletionProposal.
Comment 6 Bryan Wilkinson CLA 2007-02-06 09:00:28 EST
Looks good.  I agree with placing the responsibility on the proposal computer to avoid conflicts with the other computers.
Comment 7 Anton Leherbauer CLA 2007-02-06 10:02:01 EST
Applied to HEAD. Thanks, Bryan!