diff --git a/src/VisualStudio/Core/Def/Implementation/Venus/ContainedDocument.cs b/src/VisualStudio/Core/Def/Implementation/Venus/ContainedDocument.cs index 2250bd470d7c89938a3351b6264a75a335fd17cf..b951aaceda81d3edbd8771f812e4b1e5015040e4 100644 --- a/src/VisualStudio/Core/Def/Implementation/Venus/ContainedDocument.cs +++ b/src/VisualStudio/Core/Def/Implementation/Venus/ContainedDocument.cs @@ -72,12 +72,14 @@ internal sealed class ContainedDocument : ForegroundThreadAffinitizedObject, IVi private readonly string _itemMoniker; public AbstractProject Project { get { return _containedLanguage.Project; } } - public DocumentId Id { get; private set; } - public IReadOnlyList Folders { get; private set; } - public TextLoader Loader { get; private set; } - public DocumentKey Key { get; private set; } public bool SupportsRename { get { return _hostType == HostType.Razor; } } + public DocumentId Id { get; } + public IReadOnlyList Folders { get; } + public TextLoader Loader { get; } + public DocumentKey Key { get; } + public IVsHierarchy SharedHierarchy { get; } + public ContainedDocument( AbstractContainedLanguage containedLanguage, SourceCodeKind sourceCodeKind, @@ -99,6 +101,8 @@ internal sealed class ContainedDocument : ForegroundThreadAffinitizedObject, IVi var rdt = (IVsRunningDocumentTable)componentModel.GetService().GetService(typeof(SVsRunningDocumentTable)); var filePath = rdt.GetMonikerForHierarchyAndItemId(hierarchy, itemId); + this.SharedHierarchy = hierarchy == null ? null : LinkedFileUtilities.GetSharedHierarchyForItem(hierarchy, itemId); + if (Project.Hierarchy != null) { string moniker; @@ -115,11 +119,6 @@ internal sealed class ContainedDocument : ForegroundThreadAffinitizedObject, IVi _vbHelperFormattingRule = vbHelperFormattingRule; } - public IVsHierarchy SharedHierarchy - { - get { return null; } - } - private HostType GetHostType() { var projectionBuffer = _containedLanguage.DataBuffer as IProjectionBuffer;