## Completion and templates

- Implement completion engine. It should extend ScriptCompletionEngine class. Contribute it via org.eclipse.dltk.core.completionEngine extension point.

- Contribute proposal computer via org.eclipse.dltk.ui.scriptCompletionProposalComputer. It should be derived from ScriptCompletionProposalComputer. Inside it you should create a proposal collector and template processor.

  Task of proposal collector is to accept completion proposals from completion engine, create appropriate labels for proposals and return as result set of IScriptCompletionProposal. You may use ScriptCompletionProposalCollector as base class for your implementation.

  Template processor is a separate implementation of IContentAssistProcessor that should compute proposals for templates. You should use TemplateCompletionProcessor as base class for your implementation.

- Extend ScriptCompletionProcessor and create class for your code completion processor.
- Implement getContentAssistant() method in your source viewer configuration. Example:

      public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
      	if (getEditor() != null) {
      		ContentAssistant assistant = new ContentAssistant();
      		assistant.
      			setDocumentPartitioning(
      				getConfiguredDocumentPartitioning(sourceViewer));
      		assistant.
      			setRestoreCompletionProposalSize(
      				getSettings("completion_proposal_size")); //$NON-NLS-1$
      		IContentAssistProcessor scriptProcessor = new RubyCompletionProcessor(
      				getEditor(), assistant, IDocument.DEFAULT_CONTENT_TYPE);
      		assistant.setContentAssistProcessor(scriptProcessor,
      				IDocument.DEFAULT_CONTENT_TYPE);
      		RubyContentAssistPreference.getDefault().configure(assistant,
      				fPreferenceStore);
      		assistant.
      			setContextInformationPopupOrientation(
      				IContentAssistant.CONTEXT_INFO_ABOVE);
      		assistant.setInformationControlCreator(
      			getInformationControlCreator(sourceViewer));
      		return assistant;
      	}
      	return null;
      }