Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [Dltk-dev] How to implement a CompletionProcessor that is partition aware

What I have done is override ScriptTemplateAccess# getContextTypeRegistry() to add a second ID.  Now I can add and edit templates in two contexttypes.

Question now is how to handle ScriptTemplateCompletionProcessor#getContextTypeId()?  That can only return a single ID.  If I do two implementations, one for each ID, how can the ScriptCompletionProposalComputer know which to call?

Or, is this not the right path to pursue?

Thanks,
Gerald



At 08:20 AM 4/8/2008, you wrote:
Great.  Thanks.

To do this, multiple contexts are required -- what is the proper way to add additional template contexttypes?   Do I need to implement extensions of ScriptTemplateAccess, ScriptTemplateCompletionProcessor, ScriptTemplateContext and ScriptTemplateContextType for each contexttype?  Or, is there a simpler way?

Thanks,
Gerald


At 05:36 AM 4/8/2008, you wrote:
Hi Gerald,

Please look at ScriptSourceViewerConfiguration class, it has method
alterContentAssistant(). This method associated partition with
appropriate context assistance processor.

To filter proposal you could implement
ScriptCompletionProcessor.filterAndSortProposals() method and associate
it with required partition type.

Also your could create different template completion processors for
different context's from
ScriptCompletionProposalComputer.createTemplateProposalComputer() method..

Best regards,
Andrei Sobolev.
> Eclipse 3.4M5
> DLTK 1.0M6
>
> Have implemented a CompletionProcessor and TemplateCompletionProcessor
> setup based on the Dltk Python example.  This is working, no problems.
>
> However, this example pattern appears to be *not* sensitive to the
> partition/context in which the control-space is pressed -- all
> templates are offered in the code completion popup regardless of the
> partition type.
>
> Can you provide a hint as to the proper DLTK way to
> filter/separate/limit different completion proposals based on context
> corresponding to, for example, IDocument. /DEFAULT_CONTENT_TYPE /and
> my own IPartitions. /MULTILINE_COMMENT /partition/context.
>
> Thanks,
> Gerald
> ------------------------------------------------------------------------
>
> _______________________________________________
> dltk-dev mailing list
> dltk-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/dltk-dev
>

_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev

_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev

Back to the top