Quantcast
Channel: Visual Studio Integrate forum
Viewing all articles
Browse latest Browse all 4410

Visual Studio Extension -Intercept file loading - ITextDocumentFactoryService?

$
0
0

I am writing a visual studio extension which would be used to edit parts of an xml file. I want to intercept the file load, and only load the relevant parts into the editor. I am trying to use the ITextDocumentFactoryService interface.

[Export]    
    public sealed class TextDocumentFactory
                : ITextDocumentFactoryService
    {

I create and register my service during package initialisation :

 TextDocumentFactory textDocumentFactory =  
         new TextDocumentFactory();

 ((IServiceContainer)this).AddService(
                   typeof(TextDocumentFactory),
                   textDocumentFactory, 
                   true);

My editor factory creates an editor instance and the DocumentManager opens the editor

  result = uiShellOpenDocument.OpenStandardEditor(

This then loads my file into the editor. However nothing calls my service. How do I tell VS when to use my service? Is there an easier way to intercept the file loading?

Jeff


Viewing all articles
Browse latest Browse all 4410

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>