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?
Asked
Active
Viewed 447 times
1 Answers
1
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>

Andrew Eisenberg
- 28,387
- 9
- 92
- 148
-
Thats it, thanks! This works great for javascript files. However I'd also like to add some templates for css files. I tried changing the contextTypeId to CSS, to no avail. Any thoughts? – wildabeast Mar 22 '11 at 21:39
-
It looks like the ids you need to use are `css_all` or `css_new`. Not very intuitive and the only way to find this out is by searching through the plugin.xml files. – Andrew Eisenberg Mar 22 '11 at 23:41