eclipse-plugineclipse-rcpjsdt

How to make contributions to JSDT Template Proposals


I've created an eclipse plugin which extends JSDT. When editing a JavaScript file, pressing Ctrl-Space shows "Default Proposals", consisting of general JavaScript Suggestions. Pressing Ctrl-Space again shows "Template Proposals", but the list is empty. How do I add content to the "Template Proposals" list?


Solution

  • You can use the org.eclipse.ui.editors.templates extension point for this. Something like this:

    <extension
        point="org.eclipse.ui.editors.templates">
     <template
           autoinsert="true"
           contextTypeId="javaScript"
           description="Do something"
           id="com.foo.mytemplate"
           name="A silly template">
        <pattern>
    fafdsds fafdsda fdadsa
        </pattern>
     </template>
    </extension>