Community
Participate
Working Groups
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.
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 :)
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 :)
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.
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.
Created attachment 58332 [details] Different approach to filter duplicates Forgot to add CCompletionProposal.
Looks good. I agree with placing the responsibility on the proposal computer to avoid conflicts with the other computers.
Applied to HEAD. Thanks, Bryan!