In a VSIX project, I can define a custom margin for an editor using the Editor Margin item template.
Is there any way that I can hide or show the custom margin from my Visual Studio extension?
Alternatively, is it possible for my extension to open a new editor window with a custom margin, which is not visible by default?
For my application, I was able to handle it in the margin factory, which decides whether or not to create the margin. If it does not create a margin, it simply return null.
In the margin factory, I import the TextDocumentFactoryService
[Import]
public ITextDocumentFactoryService TextDocumentFactoryService { get; set; }
and use it to get the filename in the editor
ITextDocument document;
var isok = TextDocumentFactoryService.TryGetTextDocument(wpfTextViewHost.TextView.TextDataModel.DocumentBuffer, out document ) ;
var fn = document.FilePath ;
I have also defined an MEF service of my own, which is also imported into the margin factory. I use this service to
This is used to implement the annotation function in AnkhSVN2019. The relevant files are in this directory.