• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# IVisualStudioHostDocument类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IVisualStudioHostDocument的典型用法代码示例。如果您正苦于以下问题:C# IVisualStudioHostDocument类的具体用法?C# IVisualStudioHostDocument怎么用?C# IVisualStudioHostDocument使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IVisualStudioHostDocument类属于命名空间,在下文中一共展示了IVisualStudioHostDocument类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GetContextHierarchyFromRunningDocumentTable

        /// <summary>
        /// If the document is open in the running document table, this returns the hierarchy in
        /// which it is currently open. Otherwise, it returns null.
        /// </summary>
        private IVsHierarchy GetContextHierarchyFromRunningDocumentTable(IVisualStudioHostDocument document, IVsRunningDocumentTable4 runningDocumentTable)
        {
            AssertIsForeground();
            if (!runningDocumentTable.TryGetCookieForInitializedDocument(document.Key.Moniker, out var docCookie))
            {
                return null;
            }

            runningDocumentTable.GetDocumentHierarchyItem(docCookie, out var hierarchy, out var itemid);

            return hierarchy;
        }
开发者ID:GuilhermeSa,项目名称:roslyn,代码行数:16,代码来源:LinkedFileUtilities.cs


示例2: GetSharedItemContextHierarchy

        /// <summary>
        /// If the document is in a Shared Code project, this returns that project's 
        /// SharedItemContextHierarchy. Otherwise, it returns null. 
        /// </summary>
        private IVsHierarchy GetSharedItemContextHierarchy(IVisualStudioHostDocument document)
        {
            AssertIsForeground();

            var itemId = document.GetItemId();
            if (itemId == (uint)VSConstants.VSITEMID.Nil)
            {
                // the document is no longer part of the solution
                return null;
            }

            var sharedHierarchy = GetSharedHierarchyForItem(document.Project.Hierarchy, itemId);
            if (sharedHierarchy == null)
            {
                return null;
            }

            return GetSharedItemContextHierarchy(sharedHierarchy);
        }
开发者ID:GuilhermeSa,项目名称:roslyn,代码行数:23,代码来源:LinkedFileUtilities.cs


示例3: OpenInvisibleEditor

        internal override IInvisibleEditor OpenInvisibleEditor(IVisualStudioHostDocument hostDocument)
        {
            // We need to ensure the file is saved, only if a global undo transaction is open
            var globalUndoService = this.Services.GetService<IGlobalUndoService>();
            var needsSave = globalUndoService.IsGlobalTransactionOpen(this);

            var needsUndoDisabled = false;
            if (needsSave)
            {
                if (this.CurrentSolution.ContainsDocument(hostDocument.Id))
                {
                    // Disable undo on generated documents
                    needsUndoDisabled = this.Services.GetService<IGeneratedCodeRecognitionService>().IsGeneratedCode(this.CurrentSolution.GetDocument(hostDocument.Id));
                }
                else
                {
                    // Enable undo on "additional documents" or if no document can be found.
                    needsUndoDisabled = false;
                }
            }

            return new InvisibleEditor(ServiceProvider, hostDocument.FilePath, needsSave, needsUndoDisabled);
        }
开发者ID:rgani,项目名称:roslyn,代码行数:23,代码来源:RoslynVisualStudioWorkspace.cs


示例4: IsCurrentContextHierarchy

 public static bool IsCurrentContextHierarchy(IVisualStudioHostDocument document, IVsRunningDocumentTable4 runningDocumentTable)
 {
     return document.Project.Hierarchy == GetContextHierarchy(document, runningDocumentTable);
 }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:4,代码来源:LinkedFileUtilities.cs


示例5: NotifyDocumentRegisteredToProjectAndStartToRaiseEvents_Core

        private void NotifyDocumentRegisteredToProjectAndStartToRaiseEvents_Core(IVisualStudioHostDocument document, CancellationToken cancellationToken)
        {
            AssertIsForeground();

            cancellationToken.ThrowIfCancellationRequested();

            // Ignore any other unknown kinds of documents
            var standardDocument = document as StandardTextDocument;
            if (standardDocument == null)
            {
                return;
            }

            // If it's already open, then we have nothing more to do here.
            if (standardDocument.IsOpen)
            {
                return;
            }

            if (_runningDocumentTable.TryGetCookieForInitializedDocument(document.Key.Moniker, out var docCookie))
            {
                TryProcessOpenForDocCookie(docCookie, cancellationToken);
            }

            cancellationToken.ThrowIfCancellationRequested();
            CancelPendingDocumentInitializationTask(document);
        }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:27,代码来源:DocumentProvider.cs


示例6: AddAdditionalDocument

        internal void AddAdditionalDocument(IVisualStudioHostDocument document, bool isCurrentContext)
        {
            AssertIsForeground();

            lock (_gate)
            {
                _additionalDocuments.Add(document.Id, document);
                _documentMonikers.Add(document.Key.Moniker, document);
            }

            if (_pushingChangesToWorkspaceHosts)
            {
                this.ProjectTracker.NotifyWorkspaceHosts(host => host.OnAdditionalDocumentAdded(document.GetInitialState()));

                if (document.IsOpen)
                {
                    this.ProjectTracker.NotifyWorkspaceHosts(host => host.OnAdditionalDocumentOpened(document.Id, document.GetOpenTextBuffer(), isCurrentContext));
                }
            }

            DocumentProvider.NotifyDocumentRegisteredToProjectAndStartToRaiseEvents(document);

            if (!_pushingChangesToWorkspaceHosts && document.IsOpen)
            {
                StartPushingToWorkspaceAndNotifyOfOpenDocuments();
            }
        }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:27,代码来源:AbstractProject.cs


示例7: RemoveAdditionalDocument

        internal void RemoveAdditionalDocument(IVisualStudioHostDocument document)
        {
            AssertIsForeground();

            lock (_gate)
            {
                _additionalDocuments.Remove(document.Id);
                _documentMonikers.Remove(document.Key.Moniker);
            }

            UninitializeAdditionalDocument(document);
        }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:12,代码来源:AbstractProject.cs


示例8: RemoveGeneratedDocument

        private void RemoveGeneratedDocument(IVisualStudioHostDocument document)
        {
            // We do not want to allow message pumping/reentrancy when processing project system changes.
            using (Dispatcher.CurrentDispatcher.DisableProcessing())
            {
                _documents.Remove(document.Id);
                _documentMonikers.Remove(document.Key.Moniker);

                UninitializeDocument(document);
                OnDocumentRemoved(document.Key.Moniker);
            }
        }
开发者ID:xyh413,项目名称:roslyn,代码行数:12,代码来源:AbstractProject.cs


示例9: TryCreateXamlDocument

        private bool TryCreateXamlDocument(AbstractProject project, string filePath, out IVisualStudioHostDocument vsDocument)
        {
            vsDocument = _vsWorkspace.ProjectTracker.DocumentProvider.TryGetDocumentForFile(
                project, filePath, SourceCodeKind.Regular,
                tb => tb.ContentType.IsOfType(ContentTypeNames.XamlContentType),
                _ => SpecializedCollections.EmptyReadOnlyList<string>());

            return vsDocument != null;
        }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:9,代码来源:XamlTextViewCreationListener.cs


示例10: UninitializeAdditionalDocument

        private void UninitializeAdditionalDocument(IVisualStudioHostDocument document)
        {
            if (_pushingChangesToWorkspaceHosts)
            {
                if (document.IsOpen)
                {
                    this.ProjectTracker.NotifyWorkspaceHosts(host => host.OnAdditionalDocumentClosed(document.Id, document.GetOpenTextBuffer(), document.Loader));
                }

                this.ProjectTracker.NotifyWorkspaceHosts(host => host.OnAdditionalDocumentRemoved(document.Id));
            }

            document.Opened -= s_additionalDocumentOpenedEventHandler;
            document.Closing -= s_additionalDocumentClosingEventHandler;
            document.UpdatedOnDisk -= s_additionalDocumentUpdatedOnDiskEventHandler;

            document.Dispose();
        }
开发者ID:xyh413,项目名称:roslyn,代码行数:18,代码来源:AbstractProject.cs


示例11: RemoveAdditionalDocument

        internal void RemoveAdditionalDocument(IVisualStudioHostDocument document)
        {
            _additionalDocuments.Remove(document.Id);
            _documentMonikers.Remove(document.Key.Moniker);

            UninitializeAdditionalDocument(document);
        }
开发者ID:xyh413,项目名称:roslyn,代码行数:7,代码来源:AbstractProject.cs


示例12: GetContextHierarchy

 /// <summary>
 /// Finds the current context hierarchy for the given document. If the document is in a
 /// Shared Code project, this returns that project's SharedItemContextHierarchy. If the
 /// document is linked into multiple projects, this returns the hierarchy in which it is
 /// currently open as indicated by the running document table. Otherwise, it returns the
 /// hierarchy of the document's project.
 /// </summary>
 public static IVsHierarchy GetContextHierarchy(IVisualStudioHostDocument document, IVsRunningDocumentTable4 runningDocumentTable)
 {
     return s_singleton.GetContextHierarchyInternal(document, runningDocumentTable);
 }
开发者ID:GuilhermeSa,项目名称:roslyn,代码行数:11,代码来源:LinkedFileUtilities.cs


示例13: GetContextHierarchyInternal

        private IVsHierarchy GetContextHierarchyInternal(IVisualStudioHostDocument document, IVsRunningDocumentTable4 runningDocumentTable)
        {
            AssertIsForeground();

            return GetSharedItemContextHierarchy(document) ?? GetContextHierarchyFromRunningDocumentTable(document, runningDocumentTable) ?? document.Project.Hierarchy;
        }
开发者ID:GuilhermeSa,项目名称:roslyn,代码行数:6,代码来源:LinkedFileUtilities.cs


示例14: IsCurrentContextHierarchy

 public static bool IsCurrentContextHierarchy(IVisualStudioHostDocument document, IVsRunningDocumentTable4 runningDocumentTable)
 {
     // runningDocumentTable might be null for tests.
     return runningDocumentTable != null && document.Project.Hierarchy == GetContextHierarchy(document, runningDocumentTable);
 }
开发者ID:GuilhermeSa,项目名称:roslyn,代码行数:5,代码来源:LinkedFileUtilities.cs


示例15: NotifyDocumentRegisteredToProject

        /// <summary>
        /// Notifies the document provider that this document is now registered in a project.
        /// </summary>
        public void NotifyDocumentRegisteredToProject(IVisualStudioHostDocument document)
        {
            // Ignore any other unknown kinds of documents
            var standardDocument = document as StandardTextDocument;
            if (standardDocument == null)
            {
                return;
            }

            // If it's already open, then we have nothing more to do here.
            if (standardDocument.IsOpen)
            {
                return;
            }

            uint docCookie;
            if (RunningDocumentTable.TryGetCookieForInitializedDocument(document.Key.Moniker, out docCookie))
            {
                TryProcessOpenForDocCookie(docCookie);
            }
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:24,代码来源:DocumentProvider.cs


示例16: OnFileRemovedFromProject

        internal void OnFileRemovedFromProject(IVisualStudioHostDocument document)
        {
            // Remove the document key from the filesInProjects map first because adding documents
            // to the misc files workspace requires that they not appear in this map.
            _filesInProjects.Remove(document.Key);

            uint docCookie;
            if (_runningDocumentTable.TryGetCookieForInitializedDocument(document.Key.Moniker, out docCookie))
            {
                AddDocumentToMiscellaneousOrMetadataAsSourceWorkspace(docCookie, document.Key.Moniker);
            }
        }
开发者ID:GloryChou,项目名称:roslyn,代码行数:12,代码来源:MiscellaneousFilesWorkspace.cs


示例17: OnFileIncludedInProject

        internal void OnFileIncludedInProject(IVisualStudioHostDocument document)
        {
            uint docCookie;
            if (_runningDocumentTable.TryGetCookieForInitializedDocument(document.FilePath, out docCookie))
            {
                TryRemoveDocumentFromMiscellaneousWorkspace(docCookie, document.FilePath);
            }

            _filesInProjects.Add(document.Key);
        }
开发者ID:GloryChou,项目名称:roslyn,代码行数:10,代码来源:MiscellaneousFilesWorkspace.cs


示例18: TryCreateXamlDocument

        private bool TryCreateXamlDocument(AbstractProject project, string filePath, out IVisualStudioHostDocument vsDocument)
        {
            vsDocument = _vsWorkspace.ProjectTracker.DocumentProvider.TryGetDocumentForFile(
                project, ImmutableArray<string>.Empty, filePath, SourceCodeKind.Regular, tb => tb.ContentType.IsOfType(ContentTypeNames.XamlContentType));

            return vsDocument != null;
        }
开发者ID:natidea,项目名称:roslyn,代码行数:7,代码来源:XamlTextViewCreationListener.cs


示例19: AddAdditionalDocument

        internal void AddAdditionalDocument(IVisualStudioHostDocument document, bool isCurrentContext)
        {
            _additionalDocuments.Add(document.Id, document);
            _documentMonikers.Add(document.Key.Moniker, document);

            if (_pushingChangesToWorkspaceHosts)
            {
                this.ProjectTracker.NotifyWorkspaceHosts(host => host.OnAdditionalDocumentAdded(document.GetInitialState()));

                if (document.IsOpen)
                {
                    this.ProjectTracker.NotifyWorkspaceHosts(host => host.OnAdditionalDocumentOpened(document.Id, document.GetOpenTextBuffer(), isCurrentContext));
                }
            }

            document.Opened += s_additionalDocumentOpenedEventHandler;
            document.Closing += s_additionalDocumentClosingEventHandler;
            document.UpdatedOnDisk += s_additionalDocumentUpdatedOnDiskEventHandler;

            DocumentProvider.NotifyDocumentRegisteredToProject(document);

            if (!_pushingChangesToWorkspaceHosts && document.IsOpen)
            {
                StartPushingToWorkspaceAndNotifyOfOpenDocuments();
            }
        }
开发者ID:xyh413,项目名称:roslyn,代码行数:26,代码来源:AbstractProject.cs


示例20: UninitializeDocument

        private void UninitializeDocument(IVisualStudioHostDocument document)
        {
            if (_pushingChangesToWorkspaceHosts)
            {
                if (document.IsOpen)
                {
                    this.ProjectTracker.NotifyWorkspaceHosts(host => host.OnDocumentClosed(document.Id, document.GetOpenTextBuffer(), document.Loader, updateActiveContext: true));
                }

                this.ProjectTracker.NotifyWorkspaceHosts(host => host.OnDocumentRemoved(document.Id));
            }

            if (_miscellaneousFilesWorkspaceOpt != null)
            {
                _miscellaneousFilesWorkspaceOpt.OnFileRemovedFromProject(document);
            }

            document.Opened -= s_documentOpenedEventHandler;
            document.Closing -= s_documentClosingEventHandler;
            document.UpdatedOnDisk -= s_documentUpdatedOnDiskEventHandler;

            document.Dispose();
        }
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:23,代码来源:AbstractProject.cs



注:本文中的IVisualStudioHostDocument类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IVisualStudioService类代码示例发布时间:2022-05-24
下一篇:
C# IVisual类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap