Eclipse JSDT 的 javaCompletionProposalComputer 内容辅助不提供建议

org.eclipse.wst.jsdt.ui.javaCompletionProposalComputer for Eclipse JSDT 的内容辅助没有给出建议.

首选项->JavaScript ->编辑器->内容辅助 ->高级Nodeclipse 提案"是可见的,并且被选中.

按照 Bananaweizen 的建议,
(来源:nodeclipse.org)

Content assist with org.eclipse.wst.jsdt.ui.javaCompletionProposalComputer for Eclipse JSDT gives no proposal.

In Preferences -> JavaScript -> Editor -> Content Assist -> Advanced "Nodeclipse Proposals" are visible, and selected.

as advised by Bananaweizen to Content assist for Eclipse JSDT based Editor

in plugin.xml

<extension point="org.eclipse.wst.jsdt.ui.javaCompletionProposalComputer"
   id="nodeclispe_textual_proposals"
   name="Nodeclipse Text Proposals">
   <proposalCategory icon="icons/npm/npm.gif"/>
 </extension>
 <extension point="org.eclipse.wst.jsdt.ui.javaCompletionProposalComputer"
   id="NodeclipseProposals"
   name="Nodeclipse Proposals">
   <javaCompletionProposalComputer
      class="org.nodeclipse.ui.contentassist.JSDTProposalComputer"
      categoryId="org.eclipse.ui.texteditor.textual_proposals">
      <partition type="__java_javadoc"/>
   </javaCompletionProposalComputer>
 </extension>

JSDTProposalComputer is just wrapper for NodeContentAssistant
(that implements IContentAssistProcessor), that works perfectly well for TextEditor based Editor.

public class JSDTProposalComputer implements IJavaCompletionProposalComputer {

    IContentAssistProcessor assistant = new NodeContentAssistant();

    @Override
    public List<ICompletionProposal> computeCompletionProposals(ContentAssistInvocationContext context, IProgressMonitor monitor) {
        return Arrays.asList(assistant.computeCompletionProposals(context.getViewer(), context.getInvocationOffset()));
    }

    @Override
    public List<IContextInformation> computeContextInformation(ContentAssistInvocationContext context, IProgressMonitor monitor) {
        return Arrays.asList(assistant.computeContextInformation(context.getViewer(), context.getInvocationOffset()));
    }

examples from help are

  • HippieProposalComputer - http://svn.codespot.com/a/eclipselabs.org/mobile-web-development-with-phonegap/tags/r1.2/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/text/java/HippieProposalComputer.java
  • HippieProposalProcessor - http://grepcode.com/file/repository.grepcode.com/java/eclipse.org/3.5.2/org.eclipse.ui.workbench/texteditor/3.5.1/org/eclipse/ui/texteditor/HippieProposalProcessor.java

All code is on GitHUb contentassist package https://github.com/Enide/nodeclipse-1/tree/master/org.nodeclipse.ui/src/org/nodeclipse/ui/contentassist

解决方案

Exactly as @zulus said:

try to add activate="true" in javaCompletionProposalComputer and remove

what worked is:

<extension point="org.eclipse.wst.jsdt.ui.javaCompletionProposalComputer"
   id="nodeclispe_textual_proposals"
   name="Nodeclipse Text Proposals">
   <proposalCategory icon="icons/npm/npm.gif"/>
 </extension>
 <extension point="org.eclipse.wst.jsdt.ui.javaCompletionProposalComputer"
   id="NodeclipseProposals"
   name="Nodeclipse Proposals">
   <javaCompletionProposalComputer
      class="org.nodeclipse.ui.contentassist.JSDTProposalComputer"
      categoryId="org.eclipse.ui.texteditor.textual_proposals"
      activate="true">
   </javaCompletionProposalComputer>
 </extension>


(source: nodeclipse.org)

相关文章