c# - Getting IClassifier to work with custom content type -


i trying add syntax highlighting custom content type based on text e.g.

static class rtextcontenttype {     public const string contenttypename = constants.content_type;     [export, name(contenttypename), basedefinition("text")]     internal static contenttypedefinition contenttypedefinition = null; // set via mef } 

then classifier provider declared this,

[export(typeof(iclassifierprovider)), contenttype(constants.content_type)] class rtextclassifierprovider : iclassifierprovider {    ... } 

the problem is, constructor of provider never called specified extensions. note here, provide editor factories , file extensions associated factory. can see factory getting initialized through debugging associated files.

if change content type "text" constructor gets called.

so question is, how can 1 map custom content type file extension ?

second note, using fileextensiontocontenttypedefintion

is not option, not allow lot of features..

thanks :)

your implementation of ivseditorfactory responsible setting content type of text displayed in editor. default implementation of interface includes special support fileextensiontocontenttypedefinitionattribute simple extension mechanism users don't require of more advanced features (e.g. projection buffers multiple content types).

the djangoeditorfactory class includes nested class named textbuffereventlistener, shows 1 example how editor factory might assign content types buffers displayed in editor window.