I have the ProjectItem, and want to get the IWPFTextView that is associated with it, if any.
I have tried to get an IVsTextManager, and then iterate through the views, but iVsTextManager.EnumViews always returns nothing.
Here is what I've got so far:
var txtMgr = (IVsTextManager)Package.GetGlobalService(typeof(SVsTextManager));
if (txtMgr != null)
{
IVsEnumTextViews iVsEnumTextViews;
IVsTextView[] views = null;
// Passing null will return all available views, at least according to the documentation
// unfortunately, this returns a 0x80070057 error (invalid parameter)
var errorValue = txtMgr.EnumViews(null, out iVsEnumTextViews);
if (errorValue == VSConstants.S_OK)
{
// enumerate, find the IVsTextView with a matching filename.
Surely there is another/better way??
Thanks in advance
~ Cameron
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…