Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[Dltk-dev] Handling of multiple contextTypes for code completion

Have a circumstance where Templates belonging to two different contextTypes need to be presented together for code completion -- specific use case is where script language statements can be embedded with otherwise ordinary Java statements, so both standard java (pulled from the JDT templates) and script templates need to be shown in the same completion popup.

Overriding ScriptTemplateCompletionProcessor #getTemplates(String contextTypeId) to alias one contextTypeId to multiple and return the combined set of templates works nicely. 

The problem is that ScriptTemplateCompletionProcessor#computeCompletionProposals (at line 104 in the 1.0M6 source) includes a separate contextType check that is both redundant and not easily overrideable:

        // Addes check of startsWith
        if (template.getName().startsWith(prefix)
                 && template.matches(prefix, context.getContextType().getId()))

Line 91 already constrains the template to the proper contextType Id and line 103 already checks the prefix.  I have tested removing the redundant check and it works nicely, at least for my intended purpose.

1) is there a better DLTK-way of combining multiple contextType templates?
2) if not, any reason not to remove this redundant check?
3) is bugzilla being used actively and should the bug report/enhancement request be entered there?

Thanks,
Gerald

Back to the top